Last active
October 26, 2018 16:39
-
-
Save rwhitmire/69a643e972455513fa02b397f7a8bd3e to your computer and use it in GitHub Desktop.
Query performance
This file contains 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
--Worst performing CPU bound queries | |
SELECT TOP 10 | |
st.text, | |
qp.query_plan, | |
qs.* | |
FROM sys.dm_exec_query_stats qs | |
CROSS APPLY sys.dm_exec_sql_text(qs.plan_handle) st | |
CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp | |
ORDER BY total_worker_time DESC | |
GO | |
-- Worst performing I/O bound queries | |
SELECT TOP 10 | |
st.text, | |
qp.query_plan, | |
qs.* | |
FROM sys.dm_exec_query_stats qs | |
CROSS APPLY sys.dm_exec_sql_text(qs.plan_handle) st | |
CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp | |
ORDER BY total_logical_reads DESC | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment