views:

30

answers:

1

When looking at the actual execution plan for a query in SQL Server Management Studio (SSMS), how do I determine what an expression such as Expr1052 represents?

When I identify the costly parts of the query and look at the properties of that operation, there are often references only to these Expressions, or scalar operators. I want to be able to figure out what part of my query it is referring to.

+2  A: 

In the Execution Plan window of SSMS, right click on the operation that first calculates the expression and select Properties.

You will see the expression definition in the pane to the right.

Alternatively, you can browse the XML plan and search for the entries like that:

  <DefinedValues>
    <DefinedValue>
      <ColumnReference Column="Expr1018" />
      <ScalarOperator ScalarString="col1 + col2">
      </ScalarOperator>
    </DefinedValue>
    …
  </DefinedValues>
Quassnoi
Oh I see, except in my case it wasn't in a Compute Scalar. I have to walk backwards through the tree and look at the ouput list for prior operations. Like there is an Index Spool that references Expr1052, and two nodes before that the Stream Aggregate has listed in it's Output List the Expr1052 and the Defined Values shows how it is calculated/derived.
AaronLS