count(distinct)+gby+物化视图执行优化

Viewed 63

sql如下:
select
dt_date,
case when col1 then xx,
count(distinct user_id1),
count(distinct user_id2)
from tbl_test
group by
dt_date,
case when col1 then xx;

tbl_test中 user_id1和user_id2使用了bitmap union字段,同时建立了雾化视图。

上述sql,总执行时间20s,划分了三个fragment:0/1/2,fragment1耗时最长,16s+,如下图。
image.png

耗时主要在MergeTime

麻烦问下有什么好的优化点吗?

2 Answers

group by 部分的字段看能够改为常量