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

  • Learn T-SQL Querying
  • Pedro Lopes Pam Lahoud
  • 328字
  • 2021-06-24 14:38:17

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.

主站蜘蛛池模板: 肥城市| 清水县| 大英县| 兴和县| 稻城县| 福泉市| 仪陇县| 天峨县| 鸡西市| 大同市| 宿迁市| 敦化市| 龙井市| 台湾省| 大渡口区| 沂源县| 万年县| 万山特区| 吉林省| 波密县| 寻乌县| 紫金县| 莎车县| 外汇| 铁岭市| 陈巴尔虎旗| 新化县| 安化县| 诸暨市| 易门县| 安岳县| 湛江市| 高安市| 闻喜县| 勃利县| 静宁县| 三明市| 营口市| 达日县| 肇州县| 巴彦淖尔市|