Showing posts with label query text. Show all posts
Showing posts with label query text. Show all posts

Tuesday, August 07, 2012

examine query plan

the following query can be modified to examine more content of cached query plans.
--sql statement and its query plan
SELECT t.[text], qp.query_plan
    FROM sys.dm_exec_cached_plans AS p
    CROSS APPLY sys.dm_exec_sql_text(p.plan_handle) AS t
    CROSS APPLY sys.dm_exec_text_query_plan(p.plan_handle, 0, -1) AS qp;