-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#20831] YSQL: Show distinct prefix keys explicitly in the explain ou…
…tput Summary: ### Objective Before this change, the explain output looks as follows ``` yugabyte=# explain select distinct col_int_key from mm; QUERY PLAN --------------------------------------------------------------------------------------------------- Unique (cost=0.00..12.00 rows=93 width=4) -> Distinct Index Only Scan using idx_mm_col_int_key on mm (cost=0.00..12.00 rows=93 width=4) Distinct Prefix: 1 (3 rows) ``` We displayed the length of the distinct prefix because that is the sole parameter necessary for the HybridScan on the DocDB side. However, users may find it more useful if we instead displayed the keys corresponding to the index columns instead. The new output looks ``` yugabyte=# explain select distinct k1 from t; QUERY PLAN ---------------------------------------------------------------------------------- Unique (cost=0.00..22.80 rows=200 width=4) -> Distinct Index Scan using t_pkey on t (cost=0.00..22.80 rows=200 width=4) Distinct Prefix Keys: k1 (3 rows) ``` ### Solution Pick the prefix length number of leading columns from the list of index targets and print them in explain. Also, change the regression test output to reflect the change. Jira: DB-9820 Test Plan: Jenkins ./yb_build.sh --java-test TestPgRegressDistinctPushdown Reviewers: tnayak Reviewed By: tnayak Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D33042
- Loading branch information
Showing
7 changed files
with
158 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.