Execution Plan Generation and the Query Optimizer
摘要
All performance within SQL Server starts, and frequently ends, with the query optimizer. Because the optimizer is so important to query performance, we’re diving immediately into how the optimizer behaves in order to better understand why our queries perform the way they do. The optimization process results in an execution plan, a path for the query engine to follow as well as a mechanism for showing the choices the optimizer made. The optimization process is expensive in terms of resources, especially CPU, and can be somewhat time-consuming, affecting the execution time of your queries. We’ll go over what the process is, how an execution plan is generated, and how that plan goes into memory in the plan cache in the hopes of reusing the plan.