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

Create successful ePaper yourself

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

Query execution<br />

Chapter 1: <strong>Execution</strong> Plan Basics<br />

Once the optimizer has generated an execution plan, or retrieved one from cache, the<br />

action switches to the storage engine, which usually executes the query according to<br />

the plan.<br />

We will not go into detail here, except to note that the carefully generated execution plan<br />

may be subject to change during the actual execution process. For example, this might<br />

happen if:<br />

• <strong>SQL</strong> <strong>Server</strong> determines that the plan exceeds the threshold for a parallel execution<br />

(an execution that takes advantage of multiple processors on the machine – more on<br />

parallel execution in Chapter 3)<br />

• the statistics used to generate the plan were out of date, or have changed since the<br />

original execution plan was created<br />

• processes or objects within the query, such as data inserts to a temporary table, result<br />

in a recompilation of the execution plan.<br />

Any one of these could change the estimated execution plan.<br />

<strong>SQL</strong> <strong>Server</strong> returns the results of the query after the relational engine changes the format<br />

to match that requested in the submitted T-<strong>SQL</strong> statement, assuming it was a SELECT.<br />

24

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

Saved successfully!

Ooh no, something went wrong!