Guest User

Untitled

a guest
Oct 16th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. -- Clear query stats: DBCC FREEPROCCACHE
  2. SELECT DISTINCT TOP 10
  3. t.TEXT QueryName,
  4. s.execution_count AS ExecutionCount,
  5. s.max_elapsed_time AS MaxElapsedTime,
  6. ISNULL(s.total_elapsed_time / s.execution_count, 0) AS AvgElapsedTime,
  7. s.creation_time AS LogCreatedOn,
  8. ISNULL(s.execution_count / CAST(DATEDIFF(s, s.creation_time, GETDATE()) AS FLOAT), 0) AS FrequencyPerSec
  9. FROM sys.dm_exec_query_stats s
  10. CROSS APPLY sys.dm_exec_sql_text( s.sql_handle ) t
  11. ORDER BY
  12. s.max_elapsed_time DESC
  13. GO
Add Comment
Please, Sign In to add comment