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

  • 相关阅读:
    nextcloud环境搭建及部署
    docker容器内访问宿主机,访问不通 错误:Host is unreachable
    记录一下SQL的行行比较
    记录一次nginx平滑升级
    letsencrypt免费SSL证书自动续期
    守护进程因echo挂掉的原因,以及重定向标准输入、标准输出和标准错误
    openresty lua-nginx-module模块中文文档
    nginx localhost的坑
    PHP7 MongoDb的操作类
    tomcat 性能检测
  • 原文地址:https://www.cnblogs.com/hyming011/p/8251864.html
Copyright © 2011-2022 走看看