
Quick plan
This is phase one and is used if the plan found by the transaction processing phase is still more expensive than the internal threshold. This phase expands the search for a good-enough plan to cover rule-based join reordering and spools that may benefit moderately complex queries. To determine whether a good-enough plan has been found, as the Query Optimizer generates each potential query plan, it compares the cost of the plan that was just evaluated with the estimated cost of continuing to search for better plan alternatives. This effectively establishes a timeout so that we don't spend more time optimizing the query than we would spend executing the current plan. If a plan has been found with a cost lower than the cost threshold for the quick plan and lower than the timeout, optimization is stopped, and that good-enough plan is used. This avoids incurring additional compilation costs.
If the plan cost that the quick plan phase found is greater than the server configuration for the Cost Threshold for Parallelism and the server is a multiprocessor machine, then parallelism is considered. However, if the plan cost from the quick plan phase is less than the configured Cost Threshold for Parallelism, only serial plans are considered going forward.
Even if a parallel plan is produced, this doesn't mean the query plan will be executed on multiple processors. If existing processors are too busy to withstand running a query on multiple CPUs—technically meaning that there aren't enough available schedulers—then the plan will be executed on a single processor. If the MAXDOP server configuration is set to 1, parallelism is not considered at all in the optimization process.