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 5: Controlling <strong>Execution</strong> <strong>Plans</strong> with HintsFigure 5.9This query executes a little faster than the original but did we solve our read problem?Table 'Worktable'. Scan count 2, logical reads 17…Table 'ProductModelIllustration'. Scan count 1, logical reads 2…Table 'Product'. Scan count 1, logical reads 15…Table 'ProductModel'. Scan count 1, logical reads 14…Table 'Illustration'. Scan count 1, logical reads 3…Listing 5.12We've re-introduced a worktable, but it does appear that we've eliminated the largenumber of reads. We may have a solution. However, before we conclude the experiment,we may as well as try out the HASH JOIN hint, to see what it might do.OPTION ( HASH JOIN );Listing 5.13We're back to a simplified execution plan using a Hash Match join operation, as<strong>com</strong>pared to the Merge Join. The execution time is about half what the Merge Join was,and a third of the original query and the I/O looks as shown in Listing 5.14.188

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

Saved successfully!

Ooh no, something went wrong!