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).
我正在学习如何在SQL Server中读取实际的执行计划。我注意到SQL Server往往表示物理查询计划中使用的中间值,如expr1006、expr1007等(即expr后跟一个数字)。
Here is a screenshot. Notice near the bottom, the expressions expr1006, expr1008, expr1009
listed in the section output list
.
这是一个屏幕截图。注意靠近底部的表达式expr1006、expr1008、expr1009列在节输出列表中。
It it possible to find out what they really represent?
找到他们真正代表的是什么?
1 个解决方案
#1
6
Right click the compute scalar and choose "properties".
右键单击compute标量并选择“properties”。
Look in the "Defined Values" section.
请看“定义值”一节。
You will see something like expr1006 = SomeExpression()
if expr1006
is computed there. There may be multiple expressions defined.
如果计算expr1006,您将看到类似expr1006 = SomeExpression()的内容。可能定义了多个表达式。
Otherwise follow the tree down towards the leaves to find the first place that expr1006
appears and look at the properties of that operator.
否则,沿着树向下到叶子,找到expr1006出现的第一个位置,并查看该操作符的属性。
For large plans viewing as XML and searching for expr1006
is the quickest way to see where the expression is defined.
对于以XML形式查看的大型计划和搜索expr1006是查看表达式定义位置的最快方法。
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的最新版本允许您通过使用query_trace_column_values扩展事件实际查看这些表达式的值。更多信息请点击这里。
#1
6
Right click the compute scalar and choose "properties".
右键单击compute标量并选择“properties”。
Look in the "Defined Values" section.
请看“定义值”一节。
You will see something like expr1006 = SomeExpression()
if expr1006
is computed there. There may be multiple expressions defined.
如果计算expr1006,您将看到类似expr1006 = SomeExpression()的内容。可能定义了多个表达式。
Otherwise follow the tree down towards the leaves to find the first place that expr1006
appears and look at the properties of that operator.
否则,沿着树向下到叶子,找到expr1006出现的第一个位置,并查看该操作符的属性。
For large plans viewing as XML and searching for expr1006
is the quickest way to see where the expression is defined.
对于以XML形式查看的大型计划和搜索expr1006是查看表达式定义位置的最快方法。
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的最新版本允许您通过使用query_trace_column_values扩展事件实际查看这些表达式的值。更多信息请点击这里。