1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| SELECT TOP 50 execution_count, total_logical_reads / execution_count AS [Avg Logical Reads], total_elapsed_time / execution_count AS [Avg Elapsed Time], DB_NAME(st.dbid) AS [database name], OBJECT_NAME(st.dbid) AS [object name], OBJECT_NAME(st.objectid) AS [object name 1], SUBSTRING( st.text, (qs.statement_start_offset / 2) + 1, ((CASE statement_end_offset WHEN -1 THEN DATALENGTH(st.text) ELSE qs.statement_end_offset END - qs.statement_start_offset ) / 2 ) + 1 ) AS statement_text FROM sys.dm_exec_query_stats AS qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st WHERE execution_count > 100 ORDER BY 1 DESC;
|