Created
January 4, 2017 07:43
-
-
Save bartread/ef6e7d884be68693cf7a2469ed2d6732 to your computer and use it in GitHub Desktop.
Get execution plans for top SQL queries by CPU time
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
SELECT TOP 5 total_worker_time/execution_count AS [Avg CPU Time], | |
Plan_handle, query_plan | |
FROM sys.dm_exec_query_stats AS qs | |
CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) | |
ORDER BY total_worker_time/execution_count DESC; | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment