Skip to content

Commit

Permalink
Support for partial aggregations at chunk level
Browse files Browse the repository at this point in the history
This patch adds support for partial aggregations at the chunk level.
The aggregation is replanned in the create_upper_paths_hook of
PostgreSQL. The AggPath is split up into multiple
AGGSPLIT_INITIAL_SERIAL operations (one on top of each chunk), which
create partials, and one AGGSPLIT_FINAL_DESERIAL operation, which
finalizes the aggregation.
  • Loading branch information
jnidzwetzki committed Sep 12, 2023
1 parent 93519d0 commit d77f95a
Show file tree
Hide file tree
Showing 46 changed files with 4,628 additions and 1,910 deletions.
1 change: 1 addition & 0 deletions .unreleased/feature_5596
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implements: #5596 Support for partial aggregations at chunk level
13 changes: 13 additions & 0 deletions src/guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ TSDLLEXPORT bool ts_guc_enable_decompression_sorted_merge = true;
bool ts_guc_enable_per_data_node_queries = true;
bool ts_guc_enable_parameterized_data_node_scan = true;
bool ts_guc_enable_async_append = true;
bool ts_guc_enable_chunkwise_aggregation = true;
TSDLLEXPORT bool ts_guc_enable_compression_indexscan = true;
TSDLLEXPORT bool ts_guc_enable_bulk_decompression = true;
TSDLLEXPORT bool ts_guc_enable_skip_scan = true;
Expand Down Expand Up @@ -546,6 +547,18 @@ _guc_init(void)
NULL,
NULL);

DefineCustomBoolVariable("timescaledb.enable_chunkwise_aggregation",
"Enable chunk-wise aggregation",
"Enable the pushdown of aggregations to the"
" chunk level",
&ts_guc_enable_chunkwise_aggregation,
true,
PGC_USERSET,
0,
NULL,
NULL,
NULL);

DefineCustomBoolVariable("timescaledb.enable_remote_explain",
"Show explain from remote nodes when using VERBOSE flag",
"Enable getting and showing EXPLAIN output from remote nodes",
Expand Down
1 change: 1 addition & 0 deletions src/guc.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extern TSDLLEXPORT bool ts_guc_enable_per_data_node_queries;
extern TSDLLEXPORT bool ts_guc_enable_parameterized_data_node_scan;
extern TSDLLEXPORT bool ts_guc_enable_async_append;
extern TSDLLEXPORT bool ts_guc_enable_skip_scan;
extern TSDLLEXPORT bool ts_guc_enable_chunkwise_aggregation;
extern bool ts_guc_restoring;
extern int ts_guc_max_open_chunks_per_insert;
extern int ts_guc_max_cached_chunks_per_hypertable;
Expand Down
1 change: 1 addition & 0 deletions src/nodes/chunk_append/planner.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ ts_chunk_append_get_scan_plan(Plan *plan)
return NULL;
break;
case T_MergeAppend:
case T_Agg:
return NULL;
break;
default:
Expand Down
Loading

0 comments on commit d77f95a

Please sign in to comment.