Home » SQL Server » SQL Server || Query Execution plan from XML to Graphical View

SQL Server || Query Execution plan from XML to Graphical View

1) We can get queries execution plan from below query

SELECT

–st.text, qs.EXECUTION_COUNT

qs.*, cp.*

FROM sys.dm_exec_query_stats AS qs

CROSS APPLY sys.dm_exec_sql_text(sql_handle)AS st

CROSS APPLY sys.dm_exec_query_plan(plan_handle) AS cp

2) Column query_plan is having execution plan in XML form

3) When we click hyperlink in query_plan column, in SQL 2005,2008 & 2008 R2 it open as XML but in SQL 2012 it converted to graphical view

4) To convert XML to graphical view, save XML file with extension .sqlplan & open it with SSMS

5) Now plan will show in graphical view

Leave a Reply

Join us on Facebook

microsoftcommunitycontributor
%d bloggers like this: