非int类型字段的精确去重太难搞了,物化视图,bitmap都不太好使

背景:
想要精确去重的字段,类似这种
字段:
asjlfjaojflsfjjiworiovnN2=SAF+SFJLAJFowefjwfjOJO123+SNK
asfj-fasl-sasw-salf-aslj-asdf-2wnr-nvia

数据量:10亿

去重后结果数据量:1亿

尝试方案:
1.建全局字典,导入starrocks中,建立agg模型表,字段类型为 bitmap union_bitmap
但是查询时间近1s

profile分析:
count(distinct string)查询时,底层已经match bitmap_union_count() 函数;为效率最高了吧

2.建 duplicate 表,字段类型为 varchar,直接count(distinct string) 查询时间超过 6s;
但是不知道该如何建物化视图,去做精确去重
没法用 bitmap_union(to_bitmap())
若通过 bitmap_hash等方式,建立bitmap类型的物化视图,则数据不准,hash存在冲突,不精确。

求教,社区同学有啥思路吗 非常感谢!!

发个profile

profile.txt (170.1 KB)

已经补上profile 辛苦看下 感谢

set new_planner_agg_stage=4;
然后直接select count distinct string 看看要多久,然后再发一个profile

profile2.txt (173.4 KB)

修改set后查询时间还是差不多 800ms左右

建表语句
ddl.txt (2.0 KB)

set 设置完之后直接count distinct duplicate 表要多久

15s
duplicateprofile.txt (346.7 KB)

可以考虑把并行调大点