find plan handle of query already executed

  • I am trying to find actual execution plan of a adhoc query. SO i want to find the plan handle so that i can pass through sys.dm_exec_query_plan to get the actual execution plan. Any way to find the plan handle of a given adhoc query?

  • Query sys.dm_exec_cached_plans, cross apply to sys.dm_exec_sql_text and search for the text matching the ad-hoc query.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply