Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 682385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:35:23+00:00 2026-05-14T01:35:23+00:00

How to find the worst performing queries in SQL Server 2008? I found the

  • 0

How to find the worst performing queries in SQL Server 2008?

I found the following example but it does not seem to work:

SELECT TOP 5 obj.name, max_logical_reads, max_elapsed_time
FROM sys.dm_exec_query_stats a
CROSS APPLY sys.dm_exec_sql_text(sql_handle) hnd
INNER JOIN sys.sysobjects obj on hnd.objectid = obj.id
ORDER BY max_logical_reads DESC

Taken from:

http://www.sqlservercurry.com/2010/03/top-5-costly-stored-procedures-in-sql.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:35:24+00:00Added an answer on May 14, 2026 at 1:35 am

    top 10 worst queries based on…:

    SELECT TOP 10
        total_worker_time/execution_count AS Avg_CPU_Time
            ,execution_count
            ,total_elapsed_time/execution_count as AVG_Run_Time
            ,(SELECT
                  SUBSTRING(text,statement_start_offset/2,(CASE
                                                               WHEN statement_end_offset = -1 THEN LEN(CONVERT(nvarchar(max), text)) * 2 
                                                               ELSE statement_end_offset 
                                                           END -statement_start_offset)/2
                           ) FROM sys.dm_exec_sql_text(sql_handle)
             ) AS query_text 
    FROM sys.dm_exec_query_stats 
    
    --pick your criteria
    
    ORDER BY Avg_CPU_Time DESC
    --ORDER BY AVG_Run_Time DESC
    --ORDER BY execution_count DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling to find the mercurial workflow that fits the way that we work.
is there any nice GNU way how to measure average (worst case, best case)
recently I've installed the FireGestures plugin for Firefox, which I find very useful. You
I'm triying to find a good emulator for the Blackberry browser, so I can
I've been programming with Java for Android quite some while now. Since performance is
This question is slightly different from the kind of finding longest sequence or substring
Is there an easy way to dynamically discover all the XAMLs files within all
What is the name for the sort used in this answer ? I Googled
I'm writing a simple automated test application for Win32. It runs as a separate
We have a Java product that uses a lot of FOSS/COTS software. A number

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.