30.06.2013 Views

SQL Server Execution Plans - Red Gate Software

SQL Server Execution Plans - Red Gate Software

SQL Server Execution Plans - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 3: Text and XML <strong>Execution</strong> <strong>Plans</strong> for Basic Queries<br />

|--Index Seek<br />

(OBJECT:([AdventureWorks2008R2].[HumanResources].<br />

[Employee].[AK_Employee_LoginID] AS [e]),<br />

SEEK:([e].[LoginID]=CONVERT_IMPLICIT(nvarchar(4000),[@1],0)) ORDERED FORWARD)<br />

Listing 3.3<br />

The DefinedValues column for a given PLAN_ROW contains a comma-delimited list of the<br />

values that the operator introduces to the data flow between operators. These values may<br />

be present in the current query (in the SELECT or WHERE clauses), as is the case for our<br />

Index Seek operator, where this column contains:<br />

[e].[BusinessEntityID], [e].[LoginID]<br />

Listing 3.4<br />

Alternatively, they could be internal (intermediate) values that the query processor needs<br />

in order to process the query. Think of DefineValues as a temporary holding place for<br />

values used by the query optimizer as the operators execute.<br />

Finally, note from the EstimateRows column that the Index Seek operation produces an<br />

estimated one row.<br />

Next, Line 4 (NodeID 5), a Clustered Index Seek against HumanResources.Employee.<br />

This immediately illustrates what I would regard as a weakness with text plan format. It is<br />

not immediately obvious, as it was with the graphical plan, that this operation is, in fact,<br />

a Key Lookup operation. We need to scan through the whole contents of the StmtText<br />

column to find this out (Listing 3.5).<br />

|--Clustered Index Seek<br />

(OBJECT:([AdventureWorks2008R2].[HumanResources].<br />

[Employee].[PK_Employee_BusinessEntityID] AS [e]),<br />

SEEK:([e].[BusinessEntityID]=[AdventureWorks2008R2].[HumanResources].<br />

[Employee].[BusinessEntityID] as [e].[BusinessEntityID])<br />

LOOKUP ORDERED FORWARD)<br />

Listing 3.5<br />

120

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!