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 ...

Get Inside Microsoft® SQL Server™ 2005: Query Tuning and Optimization 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.