cockroachdb / cockroachdb/cockroach

sql/stats: support arbitrary partial statistics over multiple spans

Open
#154,040 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

We disabled creating statistics with a `WHERE` clause requiring scanning more than one span in #153419. The merging logic assumes that the histogram is continuous and represents a scan over its full range, which wouldn't be the case if the stat collection was over multiple spans.

Note that partial stats `USING EXTREMES` scans two spans which are merged properly as a special case, by splitting the buckets before and after the full stat's lower bound and merging them separately. We could do something similar for partial stats with a `WHERE` clause to support those over multiple spans.

Jira issue: CRDB-54807

Epic CRDB-55121

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.