Created
April 21, 2013 02:19
-
-
Save jdaigle/5428198 to your computer and use it in GitHub Desktop.
query for single use ad hoc queries in the plan cache
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 [text], cp.size_in_bytes, plan_handle | |
FROM sys.dm_exec_cached_plans AS cp | |
CROSS APPLY sys.dm_exec_sql_text(plan_handle) | |
WHERE | |
cp.cacheobjtype = N'Compiled Plan' | |
AND cp.objtype = N'Adhoc' | |
AND cp.usecounts = 1 | |
ORDER BY cp.size_in_bytes DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment