POC for rewriting queries with Caggs, add early validations#8967
Draft
natalya-aksman wants to merge 1 commit intotimescale:mainfrom
Draft
POC for rewriting queries with Caggs, add early validations#8967natalya-aksman wants to merge 1 commit intotimescale:mainfrom
natalya-aksman wants to merge 1 commit intotimescale:mainfrom
Conversation
|
@melihmutlu, @svenklemm: please review this pull request.
|
76eabff to
259c405
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8967 +/- ##
==========================================
+ Coverage 85.72% 85.86% +0.14%
==========================================
Files 245 247 +2
Lines 48167 48806 +639
Branches 10748 10937 +189
==========================================
+ Hits 41289 41909 +620
- Misses 3522 3572 +50
+ Partials 3356 3325 -31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
24fb146 to
a0273a4
Compare
a0273a4 to
db51394
Compare
7726617 to
5d112ca
Compare
5d112ca to
cc21763
Compare
4d37d7c to
004fa25
Compare
svenklemm
reviewed
Jan 29, 2026
svenklemm
reviewed
Jan 31, 2026
svenklemm
reviewed
Jan 31, 2026
dcc7234 to
974f4bb
Compare
974f4bb to
f16bfca
Compare
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.
POC currently checks whether queries can be rewritten with Caggs and rewrites queries with Caggs if it can.
GUCs
enable_cagg_rewitesandcagg_rewrites_debug_infoare OFF by default. If onlycagg_rewrites_debug_infois ON diagnostics on whether query can be rewritten with Caggs will be printed but query won't be rewritten.Only real-time Caggs are currently considered as candidates.
Reaggregation is out of scope for this POC i.e. we look for exact match on time buckets and aggregates provided by Caggs.
Validation methods in
tsl/src/continuous_aggs/common.cwere refactored so they could be reused by Cagg rewrites validations.PG15is currently not supported as view queries inPG15_LEhave dummy range table entries which complicates expression matching. As we plan to stopPG15support in 6 months it seems like an unnecessary complication to deal with.TODO:
Issue #9225 should complete "Query rewrites with Caggs" project by adding fully real-time mode which, for each Cagg used in a query, will combine materialized data plus live data above the current Cagg watermark and live data from current Cagg invalidated ranges.
Completing #9225 will ensure that for every query eligible to be rewritten with Caggs we will use as much materialized data as possible while still providing the same output whether the query was rewritten with a Cagg or not.