-
Notifications
You must be signed in to change notification settings - Fork 4k
Open
Labels
A-hash-shardingHash-sharded indexesHash-sharded indexesA-sql-optimizerSQL logical planning and optimizations.SQL logical planning and optimizations.C-performancePerf of queries or internals. Solution not expected to change functional behavior.Perf of queries or internals. Solution not expected to change functional behavior.E-quick-winLikely to be a quick win for someone experienced.Likely to be a quick win for someone experienced.T-sql-queriesSQL Queries TeamSQL Queries Team
Description
Consider the following range query on a table with a hash-sharded primary index:
CREATE TABLE a (a INT NOT NULL, PRIMARY KEY (a) USING HASH WITH (bucket_count = 16));
EXPLAIN (VERBOSE) SELECT * FROM a WHERE a >=1 AND a < 5;The only possible buckets that could contain rows are:
- a=1: bucket 11
- a=2: bucket 6
- a=3: bucket 13
- a=4: bucket 2
And yet we build a plan that scans all 16 buckets, instead of just the 4 that cover this range. It would be nice to only scan the necessary buckets.
Jira issue: CRDB-50914
Metadata
Metadata
Assignees
Labels
A-hash-shardingHash-sharded indexesHash-sharded indexesA-sql-optimizerSQL logical planning and optimizations.SQL logical planning and optimizations.C-performancePerf of queries or internals. Solution not expected to change functional behavior.Perf of queries or internals. Solution not expected to change functional behavior.E-quick-winLikely to be a quick win for someone experienced.Likely to be a quick win for someone experienced.T-sql-queriesSQL Queries TeamSQL Queries Team
Type
Projects
Status
Backlog