Skip to content

Commit 76eabff

Browse files
POC for rewriting queries with Caggs, add early validations
1 parent ae1f8e4 commit 76eabff

23 files changed

+2560
-793
lines changed

src/guc.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ TSDLLEXPORT bool ts_guc_enable_delete_after_compression = false;
149149
TSDLLEXPORT bool ts_guc_enable_merge_on_cagg_refresh = false;
150150

151151
bool ts_guc_enable_partitioned_hypertables = false;
152+
TSDLLEXPORT bool ts_guc_enable_cagg_rewrites = false;
153+
TSDLLEXPORT bool ts_guc_cagg_rewrites_debug_info = false;
152154

153155
/* default value of ts_guc_max_open_chunks_per_insert and
154156
* ts_guc_max_cached_chunks_per_hypertable will be set as their respective boot-value when the
@@ -760,6 +762,28 @@ _guc_init(void)
760762
NULL,
761763
NULL);
762764

765+
DefineCustomBoolVariable(MAKE_EXTOPTION("enable_cagg_rewrites"),
766+
"Enable rewriting queries with Caggs",
767+
"Enable rewriting queries with eligible continuous aggregates",
768+
&ts_guc_enable_cagg_rewrites,
769+
false,
770+
PGC_USERSET,
771+
0,
772+
NULL,
773+
NULL,
774+
NULL);
775+
776+
DefineCustomBoolVariable(MAKE_EXTOPTION("cagg_rewrites_debug_info"),
777+
"Print debug info about whether queries can be rewritten with Caggs",
778+
"Print debug info about whether queries can be rewritten with Caggs",
779+
&ts_guc_cagg_rewrites_debug_info,
780+
false,
781+
PGC_USERSET,
782+
0,
783+
NULL,
784+
NULL,
785+
NULL);
786+
763787
DefineCustomBoolVariable(MAKE_EXTOPTION("enable_compression_wal_markers"),
764788
"Enable WAL markers for compression ops",
765789
"Enable the generation of markers in the WAL stream which mark the "

src/guc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ extern TSDLLEXPORT bool ts_guc_enable_multikey_skip_scan;
7979
extern TSDLLEXPORT double ts_guc_skip_scan_run_cost_multiplier;
8080
extern TSDLLEXPORT bool ts_guc_debug_skip_scan_info;
8181

82+
extern TSDLLEXPORT bool ts_guc_enable_cagg_rewrites;
83+
extern TSDLLEXPORT bool ts_guc_cagg_rewrites_debug_info;
84+
8285
/* Only settable in debug mode for testing */
8386
extern TSDLLEXPORT bool ts_guc_enable_null_compression;
8487
extern TSDLLEXPORT bool ts_guc_enable_compression_ratio_warnings;

src/planner/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ set(SOURCES
44
${CMAKE_CURRENT_SOURCE_DIR}/agg_bookend.c
55
${CMAKE_CURRENT_SOURCE_DIR}/constify_now.c
66
${CMAKE_CURRENT_SOURCE_DIR}/constraint_cleanup.c
7+
${CMAKE_CURRENT_SOURCE_DIR}/continuous_aggs_common.c
8+
${CMAKE_CURRENT_SOURCE_DIR}/continuous_agg_rewrites.c
79
${CMAKE_CURRENT_SOURCE_DIR}/expand_hypertable.c
810
${CMAKE_CURRENT_SOURCE_DIR}/partialize.c
911
${CMAKE_CURRENT_SOURCE_DIR}/space_constraint.c)

0 commit comments

Comments
 (0)