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 2: Graphical <strong>Execution</strong> <strong>Plans</strong> for Basic Queries _____ 62<br />

The Language of Graphical <strong>Execution</strong> <strong>Plans</strong> ______________________________ 62<br />

Some Single Table Queries ______________________________________________65<br />

Clustered Index Scan ________________________________________________65<br />

Clustered Index Seek _______________________________________________ 68<br />

NonClustered Index Seek ___________________________________________ 70<br />

Key Lookup _______________________________________________________ 73<br />

Table Scan ________________________________________________________79<br />

RID Lookup ______________________________________________________ 80<br />

Table Joins ___________________________________________________________83<br />

Hash Match join __________________________________________________ 86<br />

Nested Loops join _________________________________________________ 89<br />

Compute Scalar ____________________________________________________92<br />

Merge Join ________________________________________________________93<br />

Filtering Data _______________________________________________________ 96<br />

<strong>Execution</strong> <strong>Plans</strong> with GROUP BY and ORDER BY _________________________ 99<br />

Sort _____________________________________________________________ 99<br />

Hash Match (aggregate) _____________________________________________ 103<br />

Filter ____________________________________________________________104<br />

A brief aside on rebinds and rewinds __________________________________ 105<br />

<strong>Execution</strong> <strong>Plans</strong> for INSERT, UPDATE and DELETE Statements _____________108<br />

INSERT statements ________________________________________________109<br />

UPDATE statements _______________________________________________ 112<br />

DELETE statements _______________________________________________ 114<br />

Summary ___________________________________________________________ 114<br />

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

Text <strong>Execution</strong> <strong>Plans</strong> _________________________________________________ 117<br />

A text plan for a simple query ________________________________________ 117<br />

A text plan for a slightly more complex query ___________________________ 121<br />

XML <strong>Execution</strong> <strong>Plans</strong> _________________________________________________126<br />

An estimated XML plan _____________________________________________ 127<br />

An actual XML plan ________________________________________________ 134

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

Saved successfully!

Ooh no, something went wrong!