官术网_书友最值得收藏!

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.

This timeout is not a fixed number, but rather a non-linear value that is related to the complexity of the incoming T-SQL statement. Complexity is translated into cost, so the higher the cost of the query plan, the higher the threshold will be for that plan.

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.

主站蜘蛛池模板: 林西县| 商丘市| 临夏市| 周口市| 滦平县| 济源市| 屏南县| 岢岚县| 延吉市| 苍溪县| 从化市| 罗山县| 南通市| 安顺市| 巴青县| 扎兰屯市| 中方县| 浦县| 明光市| 利川市| 枣强县| 故城县| 临夏市| 上蔡县| 宁晋县| 无为县| 新宁县| 四子王旗| 红安县| 洛隆县| 甘谷县| 佛坪县| 建阳市| 逊克县| 班玛县| 三江| 双辽市| 余江县| 海盐县| 青河县| 滁州市|