StarRocks / starrocks

StarRocks, a Linux Foundation project, is a next-generation sub-second MPP OLAP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics, and ad-hoc queries.
https://starrocks.io
Apache License 2.0
8.61k stars 1.74k forks source link

关于前缀索引字符串截断问题 #45692

Open hungrytortoise opened 3 months ago

hungrytortoise commented 3 months ago

Steps to reproduce the behavior (Required)

1、建表语句 CREATE TABLE short_key_test ( user_id string NOT NULL COMMENT "", app varchar(65533) NOT NULL COMMENT "", acct_no varchar(65533) NOT NULL COMMENT "" ) ENGINE = OLAP PRIMARY KEY(user_id,app,acct_no) DISTRIBUTED BY HASH(acct_no) order by (app,user_id).'

explain analyze select * from ads.short_key_test where app='ccc' and user_id='123';

Expected behavior (Required)

按照文档描述,创建前缀索引会被第一个字符串截断。所以生效的只有app的前缀索引 image

Real behavior (Required)

实际查看profile 前缀索引过滤掉了只剩一行记录,即user_id 也生效了

StarRocks version (Required)

-3.1.7

hungrytortoise commented 3 months ago

一共:1038808 记录; profile中查看过滤掉 1038807 image