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>GOFROM [Sales].[SalesTaxRate] stJOIN [Person].[StateProvince] spON [st].[StateProvinceID] = [sp].[StateProvinceID]WHERE [sp].[CountryRegionCode] = @CountryRegionCodeORDER BY [StateName] ;Listing 4.1Which we can then execute:EXEC [Sales].[spTaxRateByState] @CountryRegionCode = 'US';Listing 4.2The resulting actual execution plan is quite simple, as shown in Figure 4.1.Figure 4.1Starting from the right, we see a Clustered Index Scan operator, which gets the list of taxrates. The query <strong>com</strong>bines this data with data pulled from the States table, based onthe parameter, @CountryRegionCode, visible in the ToolTip or the Properties window,through a Nested Loops operation.139

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

Saved successfully!

Ooh no, something went wrong!