【已解决】bitmap_union类型的字段查询很慢怎么排查?

Viewed 25

版本:2.0.12

agg模型的表,其中key为pt、code,value为code_bm

CREATE TABLE ad (
pt date,
code varchar(100),
code_bm bitmap BITMAP_UNION,
xxx
)

如下两个查询耗时差不多,bitmap字段加速效果不明显,这个要如何排查呢?

select
  pt,
  count(distinct code)
from
  ad
where
  pt between '20230101' and '20231231'
group by
  pt
select
  pt,
  count(distinct code_bm)
from
  ad
where
  pt between '20230101' and '20231231'
group by
  pt
1 Answers
  1. BITMAP列通常是配套的bitmap_union_count、bitmap_union、bitmap_hash、bitmap_hash64等函数进行查询或使用
  2. 通常查询性能慢可以基于profile进行分析:query_profile