加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 09:19:20 所属栏目:百科 来源:网络整理
导读: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 m

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)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读