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 5: Controlling <strong>Execution</strong> <strong>Plans</strong> with Hints<br />

This results in the mismatched set of query plans in Figure 5.24.<br />

Figure 5.24<br />

Note that the second query is now using our IX_SalesOrderHeader_SalesPersonID<br />

index, which resulted in a slightly longer execution time, but only 409 reads compared to<br />

the 686 of the original query.<br />

ROBUST PLAN<br />

This query hint is used when you need to work with very wide rows. For example:<br />

• a row that contains one or more variable length columns set to very large size or<br />

even the MAX size introduced in 2005<br />

• a row that contains one or more large objects (LOB) such as BINARY, XML or TEXT<br />

data types.<br />

Sometimes, when processing these rows, it's possible for some operators to encounter<br />

errors, usually when creating worktables as part of the plan. The ROBUST PLAN hint<br />

ensures that a plan that could cause errors won't be chosen by the optimizer.<br />

208

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

Saved successfully!

Ooh no, something went wrong!