17.07.2015 Views

SQL Server Execution Plans - Grant Fritchey - SQLServerCentral.com

SQL Server Execution Plans - Grant Fritchey - SQLServerCentral.com

SQL Server Execution Plans - Grant Fritchey - SQLServerCentral.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 4: Understanding More Complex Query <strong>Plans</strong>Let's execute this procedure, capturing the actual XML plan.SET STATISTICS XML ON;GOEXEC [dbo].[uspGetEmployeeManagers] @EmployeeID = 9;GOSET STATISTICS XML OFF;GOListing 4.7We get an execution plan of reasonable <strong>com</strong>plexity, so let's break it down into sections inorder to evaluate it. We will examine parts of the XML plan alongside the graphical plan.Figure 4.9 displays the top right-hand section of the graphical plan.Figure 4.9A Nested Loops join takes the data from two Clustered Index Seeks againstHumanResources.Employee and Person.Person. The Scalar operator puts inthe constant "0" from the original query for the derived column, RecursionLevel.The second scalar, carried to a later operator, is an identifier used as part of theConcatenation operation.151

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

Saved successfully!

Ooh no, something went wrong!