zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

2023-03-08 mysql列存储数据库-查询执行过程分析

mysql数据库存储执行 分析 查询 过程 2023
2023-09-27 14:25:42 时间

摘要:

在mysql的sql层和存储引擎的交互模式中, 存储引擎实现handler接口, 由SQL层负责调用接口, 所以执行的过程可以看作是在sql层中, innodb仅提供接口。

但是在mysql列存储引擎中, TMD直接替换掉了sql层的执行接口,并且将sql层的查询树转换成了自己的一套查询树, 然后根据自己的查询树执行查询。

本文以以TPCH-Q16为例进行分析查询执行过程。

DML

查询SQL

select
        p_brand,
        p_type,
        p_size,
        count(distinct ps_suppkey) as supplier_cnt
from
        partsupp,
        part
where
        p_partkey = ps_partkey
        and p_brand <> 'Brand#34'
        and p_type not like 'LARGE BRUSHED%'
        and p_size in (48, 19, 12, 4, 41, 7, 21, 39)
        and ps_suppkey not in (
                select
                        s_suppkey
                from
                        supplier
                where
                        s_comment like '%Customer%Complaints%'
        )
group by
        p_brand,
        p_type,
        p_size
having supplier_cnt = 7