Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/columnar.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ extern bool columnar_enable_bloom_filter; /* bloom equality skipping (I7) */

/* Phase 6 GUCs (spec 8.3) */
extern bool columnar_enable_vectorization; /* vectorized aggregate path */
extern bool columnar_enable_group_vectorization; /* GROUP BY vectorized agg (#289) */
extern int columnar_groupagg_max_groups; /* plan-time group-count cap (#289) */
extern bool columnar_enable_read_stream; /* stream/prefetch block reads (PG17+) */
extern bool columnar_enable_index_only_scan; /* allow index-only scans (gap 28) */
extern bool columnar_enable_projection_scan; /* scan a covering projection (gap 26) */
Expand Down Expand Up @@ -772,6 +774,7 @@ extern void ColumnarCustomScanInit(void);
*/
extern const CustomScanMethods columnar_scan_methods;
extern Node *ColumnarCreateAggScanState(CustomScan *cscan);
extern Node *ColumnarCreateGroupAggScanState(CustomScan *cscan);

/*
* Build the chunk-group skip scan keys from a plan's restriction clauses.
Expand Down
10 changes: 10 additions & 0 deletions src/columnar_customscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,17 @@ static Node *
ColumnarCreateScanState(CustomScan *cscan)
{
if (cscan->scan.scanrelid == 0)
{
/*
* Both upper aggregate paths are scanrelid==0 custom scans sharing these
* registered methods. The grouped path (#289) carries a length-5
* custom_private (rti, quals, relid, keys, output map); the ungrouped
* path carries length 3.
*/
if (list_length(cscan->custom_private) == 5)
return ColumnarCreateGroupAggScanState(cscan);
return ColumnarCreateAggScanState(cscan);
}

return ColumnarCreateBaseScanState(cscan);
}
Expand Down
22 changes: 22 additions & 0 deletions src/columnar_tableam.c
Original file line number Diff line number Diff line change
Expand Up @@ -2244,6 +2244,28 @@ _PG_init(void)
0,
NULL, NULL, NULL);

DefineCustomBoolVariable("pgcolumnar.enable_group_vectorization",
"Use the vectorized aggregate fast path for GROUP BY queries.",
NULL,
&columnar_enable_group_vectorization,
false,
PGC_USERSET,
0,
NULL, NULL, NULL);

DefineCustomIntVariable("pgcolumnar.groupagg_max_groups",
"Cap on the actual group count the grouped vectorized "
"aggregate builds before it stops with an error.",
"Enforced at execution against the real number of groups, "
"not the planner's estimate: over the cap the query errors "
"rather than falling back, since the plan is fixed by then. "
"Raise it, or turn off pgcolumnar.enable_group_vectorization.",
&columnar_groupagg_max_groups,
1000000, 1, INT_MAX,
PGC_USERSET,
0,
NULL, NULL, NULL);

DefineCustomBoolVariable("pgcolumnar.enable_bloom_filter",
"Skip chunk groups on equality using per-chunk bloom filters.",
NULL,
Expand Down
Loading
Loading