zoukankan      html  css  js  c++  java
  • sql_optimizer

     PDF

    MySQL Optimizer Overview

    # Logical transformations:
                - Outer to inner joins transformation.
                - Negation elimination.                   #####   否认消除 not ( t1.a > 10 OR t2.b > 3) => (t1.a <=10 AND t2.b <= 3)
                - Equality/constant propagation.    #####   等式和常量传播 t1.a = t2.a AND t2.a = 9 AND (t1.a <= 10  AND  t2.b <=3 OR (t1.b = t2.b + 7 AND t2.b = 5)) => t1.a = 9 AND t2.a = 9 AND (9 <= 10  AND  t2.b <=3 OR (t1.b = 5 + 7 AND t2.b = 5))
                - Evaluate const expressions.       #####   求常量值 t1.a = 9 AND t2.a = 9 AND (9 <= 10  AND  t2.b <=3 OR (t1.b = 5 + 7 AND t2.b = 5)) => t1.a = 9 AND t2.a = 9 AND (9 <= 10  AND  t2.b <=3 OR (t1.b = 12 AND t2.b = 5))
                - Trivial condtion removal.             #####   不重要的条件移除 t1.a = 9 AND t2.a = 9 AND (9 <= 10  AND  t2.b <=3 OR (t1.b = 12 AND t2.b = 5)) => t1.a = 9 AND t2.a = 9 AND (t2.b <=3 OR (t1.b = 12 AND t2.b = 5))
                - Partition pruning.                         #####  分区修剪是一种非常有效的性能特性。分析修剪分析SQL中的WHERE 和FROM字句,从而在查询中消除不不必要分区
                - COUNT(*), MIN(), MAX() constant substitution in case of implicit grouping.
                - ORDER BY optimization.

               

    # Perform cost-based optimization of table order and access path selection. See JOIN::make_join_plan()
                - Assign cost to operations
                           The main cost-based optimization: 
                                  Index and access method: 
                                  Table scan (表扫)
                                  Index scan (索引扫)
                                  Range scan (范围扫)
                                  Index lookup (ref access) (索引查找(通过索引扫再引用访问原表))
                                 Join order ()
                                 Join buffering strategy ()
                                  Subquery strategy ()

                         Cost Estimate (消耗估算)
                                The cost for executing a query 
                                 Cost unit: 消耗单元
                                          read a random data page from disk 读取随机页
                                          Main cost factors: 消耗因素(CPU IO)
                                                   IO cost:  
                                                        #pages read from table 从表中读页
                                                        #pages read from index 从索引中读页
                                                   CPU cost: 
                                                        Evaluating query conditions 评估查询条件
                                                        Comparing keys/records 比较键和记录
                                                        Sorting keys 排序键

    - Assign cost to partial or alternative plans
    - Search for plan with lowest cost

  • 相关阅读:
    NTP服务器
    sublime中文设置
    13、软件定时器
    晶振和CPU周期
    红外通信协议
    KEIL使用时的一些配置
    STM32 的内部 FLASH
    STM32的程序下载
    2、触摸屏
    目录
  • 原文地址:https://www.cnblogs.com/hyming011/p/8251864.html
Copyright © 2011-2022 走看看