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 6322921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:25:22+00:00 2026-05-24T16:25:22+00:00

Is it possible to query SQL Server 2008 R2 for a list of queries

  • 0

Is it possible to query SQL Server 2008 R2 for a list of queries that have timedout?

I’m trying to find out which parts of our app are falling over, but for boring and bad reasons that won’t get fixed, we have no application level logging.

In lieu of getting some application logging put in, how can I find out which queries are timing out?

  • 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-24T16:25:22+00:00Added an answer on May 24, 2026 at 4:25 pm

    to get all the time-outs you will need to use the profiler, however you can run some queries that may help:

    show top 10 high CPU queries:

    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 
    ORDER BY Avg_CPU_Time DESC
    

    this query will show cahced query plans that “SCAN”, change comments for other things, can add filters for UseCount, EstimatedCost, EstimatedCPU, Estimated Rows

    ;WITH XMLNAMESPACES(DEFAULT N'http://schemas.microsoft.com/sqlserver/2004/07/showplan')
    , CachedPlans AS
    (SELECT
         RelOp.op.value(N'../../@NodeId', N'int') AS ParentOperationID
             ,RelOp.op.value(N'@NodeId', N'int') AS OperationID
             ,RelOp.op.value(N'@PhysicalOp', N'varchar(50)') AS PhysicalOperator
             ,RelOp.op.value(N'@LogicalOp', N'varchar(50)') AS LogicalOperator
             ,RelOp.op.value(N'@EstimatedTotalSubtreeCost ', N'float') AS EstimatedCost
             ,RelOp.op.value(N'@EstimateIO', N'float') AS EstimatedIO
             ,RelOp.op.value(N'@EstimateCPU', N'float') AS EstimatedCPU
             ,RelOp.op.value(N'@EstimateRows', N'float') AS EstimatedRows
             ,cp.plan_handle AS PlanHandle
             ,qp.query_plan AS QueryPlan
             ,st.TEXT AS QueryText
             ,cp.cacheobjtype AS CacheObjectType
             ,cp.objtype AS ObjectType
             ,cp.usecounts AS UseCounts
         FROM sys.dm_exec_cached_plans                            cp
             CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle)     st
             CROSS APPLY sys.dm_exec_query_plan(cp.plan_handle)   qp
             CROSS APPLY qp.query_plan.nodes(N'//RelOp')          RelOp (op)
    )
    SELECT
        PlanHandle
            ,ParentOperationID
            ,OperationID
            ,PhysicalOperator
            ,LogicalOperator
            ,UseCounts
            ,CacheObjectType
            ,ObjectType
            ,EstimatedCost
            ,EstimatedIO
            ,EstimatedCPU
            ,EstimatedRows
            ,QueryText
        FROM CachedPlans
        WHERE CacheObjectType = N'Compiled Plan'
    
    AND PhysicalOperator IN ('nothing will ever match this one!'
                            --,'Assert'                             
                            --,'Bitmap'
                            --,'Clustered Index Delete'
                            --,'Clustered Index Insert'
                            ,'Clustered Index Scan'
                            --,'Clustered Index Seek'
                            --,'Clustered Index Update'
                            --,'Compute Scalar'
                            --,'Concatenation'
                            --,'Constant Scan'
                            ,'Deleted Scan'
                            --,'Filter'
                            --,'Hash Match'
                            ,'Index Scan'
                            --,'Index Seek'
                            --,'Index Spool'
                            ,'Inserted Scan'
                            --,'Merge Join'
                            --,'Nested Loops'
                            --,'Parallelism'
                            ,'Parameter Table Scan'
                            --,'RID Lookup'
                            --,'Segment'
                            --,'Sequence Project'
                            --,'Sort'
                            --,'Stream Aggregate'
                            --,'Table Delete'
                            --,'Table Insert'
                            ,'Table Scan'
                            --,'Table Spool'
                            --,'Table Update'
                            --,'Table-valued function'
                            --,'Top'
                            )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: SQL Server Database query help Hi, I have a problem that I
I have created a SQL query that runs on SQL Server 2008. For some
Is it possible to query for the SQL Server 2008 service startup parameter values
We are using SQL Server 2008. We have a table called response which has
Is this possible to debug the query in SQL Server 2005. I have heard
I have some server-based reports (*.rdl) which returns data from a SQL Server 2008
I have a brain-teaser for all you SQL Server 2008 Reporting gurus out there
SQL Server 2005/ 2008 I have kept a CASE condition for a SQL query
I have built a report using Report Builder 3.0 (that uses SQL Server 2008
Possible Duplicate: sql server 2008 management studio not checking the syntax of my query

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.