Skip columnar index scan when grouping by an expression - #9828
Merged
Conversation
|
@antekresic, @natalya-aksman: please review this pull request.
|
svenklemm
force-pushed
the
sven/cis_expr
branch
2 times, most recently
from
May 15, 2026 20:14
cf0652a to
f1cf2aa
Compare
Poroma-Banerjee
approved these changes
May 15, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
svenklemm
force-pushed
the
sven/cis_expr
branch
2 times, most recently
from
May 15, 2026 20:28
368b086 to
aa8e3b5
Compare
akuzm
reviewed
May 18, 2026
|
|
||
| /* | ||
| * Every group-by column must reach the Agg as a bare Var. A wrapper such | ||
| * as GROUP BY (col)::text would leave the Agg's grpOperators bound to the |
Member
There was a problem hiding this comment.
So the reason that we don't support this at plan time is that we don't support this at execution time? Some technicality with type mismatch in aggregation node would also break, but it's not the reason, right?
Member
Author
There was a problem hiding this comment.
yes, i think we can support this, but this can currently crash so for 2.27.1 its best to disable
antekresic
approved these changes
May 18, 2026
The rewrite that swaps ColumnarScan for ColumnarIndexScan only emits bare metadata columns. When the group-by column reaches the aggregate through a cast or other wrapper, the rewrite drops the wrapper, leaving the aggregate's hash and equality functions bound to the wrapper's type and the actual data of a different type. This produced a crash for queries like GROUP BY (segmentby_col)::text on a compressed chunk. Bail out of the rewrite when any group-by column is not a bare column in the child output.
svenklemm
enabled auto-merge (rebase)
May 18, 2026 12:02
Merged
surister
pushed a commit
that referenced
this pull request
May 19, 2026
# TimescaleDB Changelog **Please note: When updating your database, you should connect using This page lists all the latest features and updates to TimescaleDB. When you use psql to update your database, use the -X flag and prevent any .psqlrc commands from accidentally triggering the load of a previous DB version.** ## 2.27.1 (2026-05-19) This release contains performance improvements and bug fixes since the 2.27.0 release. We recommend that you upgrade at the next available opportunity. **Bugfixes** * [#9795](#9795) Delete orphaned `compression_settings` before migrating catalog table * [#9799](#9799) Fix `job_errors` view leaking failed jobs to non-owners * [#9800](#9800) Check hypertable ownership before recompression * [#9801](#9801) Fix information leak in `policy_reorder_remove` * [#9824](#9824) Adding migration scripts for composite bloom filters * [#9828](#9828) Skip columnar index scan when grouping by an expression * [#9830](#9830) Skip `ColumnarIndexScan` for GROUPING SETS / ROLLUP / CUBE **Thanks** * @homanp for reporting an information leak with the job_errors view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The rewrite that swaps ColumnarScan for ColumnarIndexScan only emits
bare metadata columns. When the group-by column reaches the aggregate
through a cast or other wrapper, the rewrite drops the wrapper, leaving
the aggregate's hash and equality functions bound to the wrapper's
type and the actual data of a different type. This produced a crash
for queries like GROUP BY (segmentby_col)::text on a compressed chunk.
Bail out of the rewrite when any group-by column is not a bare column
in the child output.