Last active
October 21, 2015 13:22
-
-
Save robsonalves/69d389f57925cb217d63 to your computer and use it in GitHub Desktop.
Retorna os planos de execução em cache
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
set transaction isolation level read uncommitted | |
SELECT TOP 20 | |
st.text as [SQL] | |
, cp.cacheobjtype | |
, cp.objtype | |
, COALESCE(DB_NAME(st.dbid), db_name(cast(pa.value as int))+ '*', 'Resource') as DataBaseName | |
, cp.usecounts as [Plan Usage] | |
, qp.query_plan | |
from sys.dm_exec_cached_plans cp | |
cross apply sys.dm_exec_sql_text(cp.plan_handle) st | |
cross apply sys.dm_exec_query_plan(cp.plan_handle) qp | |
cross apply sys.dm_exec_plan_attributes(cp.plan_handle)pa | |
where pa.attribute = 'dbid' | |
and st.text like '%PartyType%' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment