Skip to content

sql,stats: add span-to-filter decoding for partial stats collection#167994

Open
yuzefovich wants to merge 1 commit intocockroachdb:masterfrom
yuzefovich:stats-decoding
Open

sql,stats: add span-to-filter decoding for partial stats collection#167994
yuzefovich wants to merge 1 commit intocockroachdb:masterfrom
yuzefovich:stats-decoding

Conversation

@yuzefovich
Copy link
Copy Markdown
Member

@yuzefovich yuzefovich commented Apr 9, 2026

Add spanToBounds which decodes index key spans into SQL filter expressions (e.g. 5 <= c AND c <= 15) to be used as WHERE clauses when collecting partial "fixup" table statistics. The function handles ASC/DESC key directions, equality, half-open and closed intervals, composite keys (truncating to the first column). For simplicity, NULLs in the boundaries are handled by resulting in a contradiction.

Informs: #152995.
Epic: None
Release note: None

Co-Authored-By: roachdev-claude roachdev-claude-bot@cockroachlabs.com

@yuzefovich yuzefovich requested review from ZhouXing19 and michae2 April 9, 2026 03:26
@yuzefovich yuzefovich requested a review from a team as a code owner April 9, 2026 03:26
@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io Bot commented Apr 9, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Add `spanToBounds` which decodes index key spans into SQL filter
expressions (e.g. `5 <= c AND c <= 15`) to be used as WHERE clauses
when collecting partial "fixup" table statistics. The function handles
ASC/DESC key directions, equality, half-open and closed intervals,
composite keys (truncating to the first column). For simplicity, NULLs
in the boundaries are handled by resulting in a contradiction.

Release note: None

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants