Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Hunting down those expensive SPs

A query to find out which Stored Procedures are taking the longest to run ( in this example – the Top 10).

I’m sure there are many other ways but this is a quick and easy script I found.

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

Comments

No comments.

Leave a Comment

Please register or log in to leave a comment.