2023-03-08 mysql列存储数据库-查询执行过程分析
摘要:
在mysql的sql层和存储引擎的交互模式中, 存储引擎实现handler接口, 由SQL层负责调用接口, 所以执行的过程可以看作是在sql层中, innodb仅提供接口。
但是在mysql列存储引擎中, TMD直接替换掉了sql层的执行接口,并且将sql层的查询树转换成了自己的一套查询树, 然后根据自己的查询树执行查询。
本文以以TPCH-Q16为例进行分析查询执行过程。
DML
查询SQL
selectp_brand,p_type,p_size,count(distinct ps_suppkey) as supplier_cnt
frompartsupp,part
wherep_partkey = ps_partkeyand 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 (selects_suppkeyfromsupplierwheres_comment like '%Customer%Complaints%')
group byp_brand,p_type,p_size
having supplier_cnt = 7