pgsql: Move per-agg and per-trans duplicate finding to the planner.

Started by Heikki Linnakangasover 5 years ago3 messagescomitters
Jump to latest
#1Heikki Linnakangas
heikki.linnakangas@enterprisedb.com

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: /messages/by-id/b2e3536b-1dbc-8303-c97e-89cb0b4a9a48@iki.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(-)

#2Michael Paquier
michael@paquier.xyz
In reply to: Heikki Linnakangas (#1)
Re: pgsql: Move per-agg and per-trans duplicate finding to the planner.

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: /messages/by-id/b2e3536b-1dbc-8303-c97e-89cb0b4a9a48@iki.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

#3Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Michael Paquier (#2)
Re: pgsql: Move per-agg and per-trans duplicate finding to the planner.

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