Skip to content

enable_partitionwise_aggregate

enable_partitionwise_aggregate — Enables partitionwise aggregation and grouping. Observed in PG11–19 Beta 3; its last measured boot default is off in PG19 Beta 3, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
Note

Fact — official short description: “Enables partitionwise aggregation and grouping.”

Identity

Type , Valuebool
Upstream pg_settings type
Context , Valueuser
Settable by an ordinary user
Unit , Value
Raw unit
Range , Value
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueQuery Tuning / Planner Method Configuration
Upstream classification
Latest boot value , Valueoff
off

Lifecycle

Fact Value
First observed PG11
Present in PG11–19 Beta 3
Removed in No
Introduction commit e2f1eb0ee30d — Implement partition-wise grouping/aggregation.
Commit date 2018-03-22
Discussion thread 1

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG11–19 Beta 3 off off

How it works

enable_partitionwise_aggregate controls whether the planner may choose per-partition grouping or aggregation, with later finalization when grouping keys do not contain partition keys.

It is consulted while a plan is built. A session-level change is useful for comparing EXPLAIN alternatives, but an already cached plan is not retroactively rewritten; invalidation or replanning is required to observe a different choice.

It can multiply work_mem-limited nodes and planning effort roughly with the number of participating partitions. Its user context permits session- or transaction-local changes; newly performed or newly planned work sees the value.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP Keep the upstream default for routine OLTP. Use a transaction- or session-local change to diagnose whether choosing per-partition grouping or aggregation, with later finalization when grouping keys do not contain partition keys explains a regression, then repair statistics, indexes, estimates, or query shape instead of leaving a cluster-wide method ban.
OLAP Benchmark representative analytical plans with and without enable_partitionwise_aggregate. Judge planning time, memory, spill, and execution time together; a win for one report is not evidence for a global setting.
Small nodes Do not use enable_partitionwise_aggregate as a permanent hint on a small host. Resource pressure may change the best method, so verify with EXPLAIN (ANALYZE, BUFFERS) and keep the change scoped to the affected workload if it is still needed.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified
OLAP on different 'on'
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG11–19 Beta 3 unmodified; OLAP: PG11–19 Beta 3 = on (dcs); CRIT: PG11–19 Beta 3 unmodified; TINY: PG11–19 Beta 3 unmodified. Advice, pending human review — Editorial inference, pending maintainer review: The OLAP-only override is intended to exploit partition-local aggregation for analytical schemas while avoiding its planning and memory multiplication in other profiles.

Common pitfalls

  • Treating enable_partitionwise_aggregate as a query hint even though it affects every plan built in its scope.
  • Testing an already cached prepared plan and concluding that the setting has no effect.
  • Masking stale statistics or cardinality errors by disabling a plan method globally.
  • It can multiply work_mem-limited nodes and planning effort roughly with the number of participating partitions.

enable_partitionwise_join · enable_partition_pruning · work_mem · enable_hashagg · max_parallel_workers_per_gather

References