TOP 100 long execution query

fiona8953發表於2016-07-24
SELECT DISTINCT TOP 100
t.TEXT QueryName,
s.execution_count AS ExecutionCount,
s.max_elapsed_time AS MaxElapsedTime,
ISNULL(s.total_elapsed_time / s.execution_count, 0) AS AvgElapsedTime,
s.creation_time AS LogCreatedOn,
ISNULL(s.execution_count / DATEDIFF(s, s.creation_time, GETDATE()), 0) AS FrequencyPerSec
FROM sys.dm_exec_query_stats s
CROSS APPLY sys.dm_exec_sql_text( s.sql_handle ) t
ORDER BY
AvgElapsedTime DESC

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26477398/viewspace-2122448/,如需轉載,請註明出處,否則將追究法律責任。

相關文章