微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将XML execution plans转换为图形界面GUI

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.jb51.cc/xml/297301.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。