[YSQL] prefix_length from distinct pushdown should only encompass distinct target columns #17607
Closed
1 task done
Labels
area/ysql
Yugabyte SQL (YSQL)
kind/enhancement
This is an enhancement of an existing feature
priority/medium
Medium priority issue
Jira Link: DB-6736
Description
Consider the following query:
We see that this results in the following output in the postgres logs:
You can see that the prefix_length field here is 3. Even if we execute the query
explain analyze select distinct(r1) from sample where r3 >= 10;
, the prefix length remains the same. If we executeexplain analyze select distinct(r1) from sample where r2 >= 10;
. The prefix length goes down to 2.This all suggests that we are using the filter columns to compute the distinct prefix length when we really should only be taking the distinct targets into account. The prefix length should be 2 for the initial example and 1 for the very last example.
Warning: Please confirm that this issue does not contain any sensitive information
The text was updated successfully, but these errors were encountered: