PostgreSQL 19 contains a planner change that targets the exact mispricing #369 is about:
Adjust the optimizer to consider startup costs of partial paths (Robert Haas, Tomas Vondra)
#369 records that the grouped vectorized aggregate's parallel arm loses to the serial node
because the core Finalize is priced off estimate_num_groups on an expression key, which
measured 25x to 42x wrong. Both settings involved are off by default because of it.
This is a measurement, not a feature. Either 19 changes the arm the planner picks on the
shapes in #369, or it does not, and the answer decides whether that issue needs code at
all or only a version gate.
What to run
The #369 shapes on 19, against 18 as the control, with the two settings on:
pgcolumnar.enable_group_vectorization
pgcolumnar.enable_parallel_vector_agg
Interleave the arms rather than sweeping them, and report the plan actually chosen
alongside the timing. A timing difference with the same plan means something else moved.
Why it is worth doing before any work on #369
If 19 fixes the pricing, the fix for older majors is a different and smaller problem than
the one #369 describes, and the issue's framing changes. If it does not, we have ruled out
the obvious explanation and #369 proceeds with one fewer unknown.
Blocked on nothing. 19 beta 2 builds in the matrix already.
Found while reviewing #390.
PostgreSQL 19 contains a planner change that targets the exact mispricing #369 is about:
#369 records that the grouped vectorized aggregate's parallel arm loses to the serial node
because the core Finalize is priced off
estimate_num_groupson an expression key, whichmeasured 25x to 42x wrong. Both settings involved are off by default because of it.
This is a measurement, not a feature. Either 19 changes the arm the planner picks on the
shapes in #369, or it does not, and the answer decides whether that issue needs code at
all or only a version gate.
What to run
The #369 shapes on 19, against 18 as the control, with the two settings on:
pgcolumnar.enable_group_vectorizationpgcolumnar.enable_parallel_vector_aggInterleave the arms rather than sweeping them, and report the plan actually chosen
alongside the timing. A timing difference with the same plan means something else moved.
Why it is worth doing before any work on #369
If 19 fixes the pricing, the fix for older majors is a different and smaller problem than
the one #369 describes, and the issue's framing changes. If it does not, we have ruled out
the obvious explanation and #369 proceeds with one fewer unknown.
Blocked on nothing. 19 beta 2 builds in the matrix already.
Found while reviewing #390.