如何找出SQL Server执行计划中使用的中间值代表什么 [英] How to find out what is represented by the intermediate value used in SQL Server execution plan

查看:35
本文介绍了如何找出SQL Server执行计划中使用的中间值代表什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习如何阅读 SQL Server 中的实际执行计划.我注意到 SQL Server 倾向于将物理查询计划中使用的中间值表示为例如expr1006expr1007 等(即 expr 后跟一个数字).

I'm learning how to read the actual execution plan in SQL Server. I have noticed that SQL Server tends to represent intermediate value used in the physical query plan as e.g. expr1006, expr1007 etc. (i.e. expr followed by a number).

这是截图.注意底部附近的表达式 expr1006, expr1008, expr1009 列在 output list 部分中.

Here is a screenshot. Notice near the bottom, the expressions expr1006, expr1008, expr1009 listed in the section output list.

有可能找出它们真正代表什么吗?

It it possible to find out what they really represent?

推荐答案

右键单击计算标量并选择属性".

Right click the compute scalar and choose "properties".

查看定义的值"部分.

如果在那里计算 expr1006,您将看到类似 expr1006 = SomeExpression() 的内容.可能定义了多个表达式.

You will see something like expr1006 = SomeExpression() if expr1006 is computed there. There may be multiple expressions defined.

否则沿着树向下向叶子方向寻找 expr1006 出现的第一个位置并查看该运算符的属性.

Otherwise follow the tree down towards the leaves to find the first place that expr1006 appears and look at the properties of that operator.

对于以 XML 格式查看的大型计划并搜索 expr1006 是查看表达式定义位置的最快方法.

For large plans viewing as XML and searching for expr1006 is the quickest way to see where the expression is defined.

以上通常就足够了.更新版本的 SQL Server 允许您使用 query_trace_column_values 扩展事件实际查看这些表达式的值.此处有更多相关信息.

The above is usually enough. More recent versions of SQL Server allow you to actually see the values of these expressions by using the query_trace_column_values extended event. More information about that here.

这篇关于如何找出SQL Server执行计划中使用的中间值代表什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆