Query Optimization
When you submit a query to SQL Server, it begins by optimizing your query for execution. Using the statistics and indexes at its disposal, the SQL Server query optimizer develops an execution plan that it believes is the most efficient way to service your query. This optimization is cost-based, with plans that cost less in terms of estimated execution time winning out over those that cost more. The costing process leans heavily toward reducing I/O operations because they are the typical bottleneck when accessing large amounts of data.
As illustrated by Figure 17-1, query plan development consists of several phases or steps:
1. |
Identify trivial plans.
|
2. |
Simplify plan.
|
3. |
Load statistics.
|
4. | Evaluate plans based on cost. ... |
Get Guru's Guide to SQL Server™ Stored Procedures, XML, and HTML, The now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.