Blog Post

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

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating