
陈举超 2020-05-07
初识 GBase 8a MPP Cluster 对分布式执行计划的理解
说明:学习了三周 GBase 8a MPP Cluster 相关知识,前段时间参加了孙云吉老师的 GBase 8a
MPP Cluster explain 分布式执行计划相关的培训,个人知识有限,只记录下本人对 GBase 8a
MPP Cluster 分布式执行计划浅显的理解(截图来自于培训内容)。
一 多表连接操作
二 group by 操作
三 优化案例举例
一 多表连接操作
1 静态 hash join 执行计划
场景:两个 hash 分布表进行 join,并且关联列是 hash 分布列。
理论上静态 hash join 是最优的,因为可以直接在各个节点上分别单独执行分布式 join 算子,
不需要拉复制表或 hash 动态重分布。
但是当 hash 分布列数据分布严重不均时,既数据倾斜严重,大多数数据集中在某一节点上,
效率也会有影响,因为分布式运算时长取决于最慢的节点。
举例说明:
create table t1 (aid int,gid int) distributed by ('gid');
create table t2 (bid int,gid int) distributed by ('gid');
insert into t1 values(1,100),(1,200),(2,100),(3,50),(2,20),(6,80),(9,10),(6,0),(3,12),(1,18),(9,1);
insert into t2 values(1,0),(300,12),(1,6),(20,50),(50,10),(1,80),(3,10),(9,15),(20,12),(13,18),(2,1);
gbase> explain select t1.aid,t2.bid from t1 inner join t2 on t1.gid=t2.gid and t1.gid=100;
评论