Skip to content

Skip dimension slices when we have empty dimension restriction - #9728

Merged
akuzm merged 7 commits into
timescale:mainfrom
akuzm:dimension-skip
May 20, 2026
Merged

Skip dimension slices when we have empty dimension restriction#9728
akuzm merged 7 commits into
timescale:mainfrom
akuzm:dimension-skip

Conversation

@akuzm

@akuzm akuzm commented May 6, 2026

Copy link
Copy Markdown
Member

During hypertable expansion, we process the qualifiers to derive the range for a dimension variable that encloses all matching rows. This range is used to find the chunks that could possibly contain these rows. When the qualifiers are contradictory, an invalid range can arise, with upper bound below lower bound. At the moment such a range can still match some dimension slices, because the dimension slice ends are checked against this range separately. The chunk will then be excluded by the Postgres constraint exclusion that handles contradictory clauses.

Add a simple check to not match such contradictory search ranges, to save some work. In the long run, this moves the hypertable expansion closer to feature parity with Postgres constraint exclusion, which is costly and maybe could be avoided eventually.

This is not visible in any tests, because the Postgres constrain exclusion compensates for whatever our hypertable expansion might miss.

Disable-check: force-changelog-file

During hypertable expansion, we process the qualifiers to derive the
range for a dimension variable that encloses all matching rows. This
range is used to find the chunks that could possibly contain these
rows. When the qualifiers are contradictory, an invalid range can arise,
with upper bound below lower bound. At the moment such a range can still
match some dimension slices, because the dimension slice ends are
checked against this range separately. The chunk will then be excluded
by the Postgres chunk exclusion that handles contradictory clauses. Add
a simple check to not match such contradictory search ranges, to save
some work.
@codecov

codecov Bot commented May 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@akuzm
akuzm marked this pull request as ready for review May 6, 2026 12:22
@akuzm
akuzm requested a review from a team May 6, 2026 12:22
@akuzm akuzm changed the title Skip dimension slices when we have empty search interval Skip dimension slices when we have empty dimension restriction May 6, 2026
@github-actions
github-actions Bot requested review from dbeck and melihmutlu May 6, 2026 12:22
@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown

@dbeck, @melihmutlu: please review this pull request.

Powered by pull-review

@akuzm
akuzm enabled auto-merge (squash) May 20, 2026 13:07
@akuzm
akuzm merged commit f45faec into timescale:main May 20, 2026
53 of 54 checks passed
@akuzm
akuzm deleted the dimension-skip branch May 20, 2026 13:08
@timescale-automation timescale-automation added the released-2.28.0 Released in 2.28.0 label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released-2.28.0 Released in 2.28.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants