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

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

The Exploration stage

If the Trivial Plan stage doesn't find a suitable plan, it's time to enter the cost-based optimization stage, known as Exploration, whose goal is to find a good-enough query execution plan based on the minimum estimated cost to access and join data. If this stage is used, the information on the optimization level is still stored in the execution plan under the same Optimization Level property, with a value of FULL.

A good-enough plan refers to the search optimization space and how SQL Server may not actually iterate through all possible plan combinations, but rather may look for a plan that meets its internal thresholds for a good-enough balance between the estimated resource usage and execution times.

The Exploration stage is where the CE comes into play. SQL Server loads statistics and performs some tasks in preparation for cost-based optimization.

These tasks are as follows:

  • Simplification transforms some sub-queries into semi-joins, and even detects whether parts of the query can skip execution, for example avoiding empty tables or searching a table column for a NULL predicate when that table column has a trusted NOT NULL constraint.
  • Normalization uses the query’s filter predicates and some heuristics to reorder join operations, and predicates are pushed-down to the algebrizer tree.

The cost-based optimization process itself is composed of three phases that we discuss in the next sections: Transaction Processing, Quick Plan, and Full Optimization. 

主站蜘蛛池模板: 阿拉善右旗| 黄石市| 安福县| 内乡县| 安溪县| 万年县| 沂南县| 东阿县| 罗定市| 康定县| 永胜县| 岳池县| 遂川县| 湘西| 英德市| 秦安县| 古交市| 开封市| 嘉义市| 常宁市| 库尔勒市| 荣成市| 若尔盖县| 枞阳县| 钦州市| 汉阴县| 平顺县| 双牌县| 仁寿县| 隆化县| 陵川县| 正蓝旗| 新巴尔虎右旗| 博兴县| 双峰县| 上饶市| 明水县| 库伦旗| 苗栗市| 南开区| 当雄县|