Thread: pgsql: Move per-agg and per-trans duplicate finding to the planner.
Move per-agg and per-trans duplicate finding to the planner. This has the advantage that the cost estimates for aggregates can count the number of calls to transition and final functions correctly. Bump catalog version, because views can contain Aggrefs. Reviewed-by: Andres Freund Discussion: https://www.postgresql.org/message-id/b2e3536b-1dbc-8303-c97e-89cb0b4a9a48%40iki.fi Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/0a2bc5d61e713e3fe72438f020eea5fcc90b0f0b Modified Files -------------- contrib/postgres_fdw/postgres_fdw.c | 12 +- src/backend/executor/execExpr.c | 10 +- src/backend/executor/execExprInterp.c | 6 +- src/backend/executor/nodeAgg.c | 364 +++--------- src/backend/jit/llvm/llvmjit_expr.c | 11 +- src/backend/nodes/copyfuncs.c | 2 + src/backend/nodes/equalfuncs.c | 2 + src/backend/nodes/outfuncs.c | 2 + src/backend/nodes/readfuncs.c | 2 + src/backend/optimizer/path/costsize.c | 3 +- src/backend/optimizer/plan/planagg.c | 69 +-- src/backend/optimizer/plan/planner.c | 66 +-- src/backend/optimizer/prep/Makefile | 1 + src/backend/optimizer/prep/prepagg.c | 678 ++++++++++++++++++++++ src/backend/optimizer/util/clauses.c | 288 --------- src/backend/parser/parse_func.c | 2 + src/backend/utils/adt/selfuncs.c | 12 +- src/include/catalog/catversion.h | 2 +- src/include/executor/execExpr.h | 3 +- src/include/nodes/execnodes.h | 11 - src/include/nodes/nodes.h | 3 +- src/include/nodes/pathnodes.h | 80 ++- src/include/nodes/primnodes.h | 8 + src/include/optimizer/clauses.h | 2 - src/include/optimizer/prep.h | 8 + src/include/utils/selfuncs.h | 2 +- src/test/regress/expected/partition_aggregate.out | 41 +- src/test/regress/sql/partition_aggregate.sql | 9 +- src/tools/pgindent/typedefs.list | 1 - 29 files changed, 954 insertions(+), 746 deletions(-)
Hi Heikki, On Tue, Nov 24, 2020 at 08:53:42AM +0000, Heikki Linnakangas wrote: > Move per-agg and per-trans duplicate finding to the planner. > > This has the advantage that the cost estimates for aggregates can count > the number of calls to transition and final functions correctly. > > Bump catalog version, because views can contain Aggrefs. > > Reviewed-by: Andres Freund > Discussion: https://www.postgresql.org/message-id/b2e3536b-1dbc-8303-c97e-89cb0b4a9a48%40iki.fi The regression tests of sepgsql are broken: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=rhinoceros&dt=2020-11-24%2009%3A52%3A17 Reordering the lines in the output file would fix the issue. -- Michael
Attachment
Re: pgsql: Move per-agg and per-trans duplicate finding to the planner.
From
Heikki Linnakangas
Date:
On 24/11/2020 12:58, Michael Paquier wrote: > The regression tests of sepgsql are broken: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=rhinoceros&dt=2020-11-24%2009%3A52%3A17 > > Reordering the lines in the output file would fix the issue. Yep, fixed, thanks! - Heikki