Last active
March 14, 2019 09:54
-
-
Save kshimi/b284134ca1812e13164fecace3cedff9 to your computer and use it in GitHub Desktop.
SQLServer Check heavy query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT TOP 100 | |
total_elapsed_time / execution_count / 1000.0 AS [平均実行時間(ミリ秒)] | |
, total_worker_time / execution_count / 1000.0 AS [平均 CPU 時間(ミリ秒)] | |
, total_physical_reads / execution_count AS [平均物理I/O 数] | |
, (total_logical_reads + total_logical_writes) | |
/ execution_count AS [平均論理I/O 数] | |
, SUBSTRING(text, (statement_start_offset / 2) + 1, | |
((CASE statement_end_offset | |
WHEN -1 THEN DATALENGTH(text) | |
ELSE statement_end_offset | |
END - statement_start_offset) / 2) + 1) AS sqltext | |
,creation_time, last_execution_time, execution_count | |
FROM | |
sys.dm_exec_query_stats | |
CROSS APPLY sys.dm_exec_sql_text(sql_handle) | |
ORDER BY 2 DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment