DataBase Query Plan(Logical Query Optimization)

2021-11-05 12:45:43 浏览数 (2)

DataBase 查询计划-逻辑查询优化器

Impala、ClicHouse、Hologres、OceanBase、Doris、MySQL、Presto、SnowFlake 、ADB 基本都有涉猎

一 分类 也是逻辑优化器的优化顺序

  1. NETSTED SUB-QUERY REWIRTE 嵌套查询的重写
  2. NETSTED SUB-QUERY DECOMPOSING 子查询 解压
  3. Split Conjunctive Predicates (条件拆分)
  4. Predicate Pushdown (条件下推)
  5. Replace Cartesian Products with Joins(operator 合并)
  6. Projection Pushdown (查询字段下推)

基础知识

代码语言:javascript复制
SELECT s.name, e.cid
FROM student AS s, enrolled AS e
WHERE s.sid = e.sid
AND e.grade = 'A'

  • T 即为一个结果
  • σ 条件
  • ⋈ join

NETSTED SUB-QUERY REWIRTE 嵌套查询的重写

NETSTED SUB-QUERY REWIRTENETSTED SUB-QUERY REWIRTE

NETSTED SUB-QUERY DECOMPOSING 子查询 解压

Nested Sub-Query DECOMPOSINGNested Sub-Query DECOMPOSING

Split Conjunctive Predicates (条件拆分)

Split Conjunctive PredicatesSplit Conjunctive Predicates

Predicate Pushdown (条件下推)

Predicate Pushdown Predicate Pushdown

Replace Cartesian Products with Joins(operator 合并)

Replace Cartesian Products with JoinsReplace Cartesian Products with Joins

Projection Pushdown (查询字段下推)

Projection PushdownProjection Pushdown

0 人点赞