Take your XML execution plan and save it to a file with a file extension of sqlplan (such as MyQuery.sqlplan) and double click on it. It will open in the sql Server Management Studio and show you the plan in the GUI plan viewer making it much easier to read than the XML version.
很简单但是很巧妙。。。比如用下面的SQL查询session的内存使用量时,dm_exec_query_plan
中的query_plan就是xml,读起来很不方便。用上面的小窍门换成图形界面后,就方便多了。
SELECT mg.session_id,mg.requested_memory_kb,mg.granted_memory_kb,mg.used_memory_kb,t.text,qp.query_plan
FROM sys.dm_exec_query_memory_grants AS mg
CROSS APPLY sys.dm_exec_sql_text(mg.sql_handle) AS t
CROSS APPLY sys.dm_exec_query_plan(mg.plan_handle) AS qp
ORDER BY 1 DESC OPTION (MAXDOP 1)
原文链接:https://www.f2er.com/xml/297301.html