Minggu, 22 Agustus 2010

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 ACROSS APPLY sys.dm_exec_sql_text(sql_handle) HINNER JOIN sys.sysobjects obj on H.objectid = obj.idORDER BY  

Tidak ada komentar:

Posting Komentar