Hello all, I have a question around prefix indexes...
# questions-and-troubleshooting
f
Hello all, I have a question around prefix indexes. I have the following table:
Copy code
CREATE TABLE IF NOT EXISTS test
(
    id bigint,
    lo_code string,
    hi_code string,
    value decimal,
    timestamp datetime
) ENGINE=OLAP
DUPLICATE KEY (id)
DISTRIBUTED BY HASH (id)
ORDER BY (id);
The table contains 1,000,000 rows and there are no duplicate
id
values present. I run the following query:
Copy code
select id, value from test where id=1;
One row is returned. I'm assuming that the above table has a prefix index since the table contains an
ORDER BY
clause. When I look at the query profile,
ShortKeyFilterRows
is zero, but
RemainingRowsAfterShortKeyFilter
indicates that many rows have been filtered:
Copy code
- RemainingRowsAfterShortKeyFilter: 62.500K (62500)
                 - ShortKeyFilter: 862ns
                 - ShortKeyFilterRows: 0
                 - ShortKeyRangeNumber: 0
                 - ZoneMapIndexFilterRows: 54.308K (54308)
                 - ZoneMapIndexFiter: 36.699us

                 - PredFilter: 10.206us
                 - PredFilterRows: 8.191K (8191)
Does anyone know why
ShortKeyFilterRows
shows zero yet
RemainingRowsAfterShortKeyFilter
is less than the table size (1M rows)? I expected to see something like the following:
Copy code
- RemainingRowsAfterShortKeyFilter: 1
                 - ShortKeyFilterRows: 999,999
r
Hello, the sort key is applied after bucket pruning - it searches the tablet that contains the row. In this case I would expect your bucket num is 16. For the
ShortKeyFilterRows: 0
, it might be that your dataset is too small - try increasing your dataset and rerun the query again.