January 6, 2012 at 7:59 am
I am running a query against sys.dm_exec_requests to look a query that is currently running. I can obviously see the sql command and execution plan from that dmv. However how do i determine if that execution plan was pulled from the dm_exec_cached_plans vs compliled on the fly? I want to know how to determine for a given request which item in the exec_chached plan it relates to (if any)
January 6, 2012 at 1:23 pm
you could try to investigate its execution count
select qs.execution_count
FROM sys.dm_exec_query_stats qs
cross apply sys.dm_exec_query_plan(qs.plan_handle) QP
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
January 10, 2012 at 4:28 am
And look at when it was created. You have that information in the sys.dm_exec_query_stats DMO.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply