Inside Microsoft® SQL Server™ 2005: Query Tuning and Optimization
by Kalen Delaney, Sunil Agarwal, Craig Freedman, Ron Talmage, Adam Machanic
Compilation and Optimization
It’s important to be aware that the compilation and optimization process is completely separate from the process of execution. The gap between when SQL Server compiles a query and when the query is executed can be as short as a few microseconds or as long as several days. Therefore, during compilation (which includes optimization), SQL Server has to determine what kind of available information will be useful when the query is executed. Not everything that is true at compilation time will be true at execution time. For example, if the optimizer took into account how many concurrent users were trying to access the same data as the query being optimized, that information could change dramatically by the time the query ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access