cockroachdb / cockroachdb/cockroach

Support partial stats at extremes on hash-sharded indexes and REGIONAL BY ROW tables

Open
#128,725 0 comments 0 reactions 0 assignees View on GitHub
A-sql-table-stats C-enhancement T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

When collecting partial stats on specified columns, we search for an index prefixed by that column in:
https://github.com/cockroachdb/cockroach/blob/c64fb80786b82b0a848bf59e271d8b2ce44db674/pkg/sql/scan.go#L227

This doesn't work for hash-sharded indexes and REGIONAL BY ROW tables since partition keys prefix the indexes. We would also need to update `bounds.ConstructUsingExtremesSpans()` to build the correct spans to be scanned: https://github.com/cockroachdb/cockroach/blob/c64fb80786b82b0a848bf59e271d8b2ce44db674/pkg/sql/stats/bounds/extremes.go#L59

We would also need to update how we select columns to collect partial stats on when unspecified by selecting the first column after the partition key.

Jira issue: CRDB-41160

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.