]> granicus.if.org Git - postgresql/commit
Support multi-stage aggregation.
authorRobert Haas <rhaas@postgresql.org>
Wed, 20 Jan 2016 18:46:50 +0000 (13:46 -0500)
committerRobert Haas <rhaas@postgresql.org>
Wed, 20 Jan 2016 18:46:50 +0000 (13:46 -0500)
commita7de3dc5c346e07e0439275982569996e645b3c2
tree9d47c8729c497aeff82b196ddf5f85f478c2a21d
parentc8642d909fdd57c36dd71e0b0bb4071523324794
Support multi-stage aggregation.

Aggregate nodes now have two new modes: a "partial" mode where they
output the unfinalized transition state, and a "finalize" mode where
they accept unfinalized transition states rather than individual
values as input.

These new modes are not used anywhere yet, but they will be necessary
for parallel aggregation.  The infrastructure also figures to be
useful for cases where we want to aggregate local data and remote
data via the FDW interface, and want to bring back partial aggregates
from the remote side that can then be combined with locally generated
partial aggregates to produce the final value.  It may also be useful
even when neither FDWs nor parallelism are in play, as explained in
the comments in nodeAgg.c.

David Rowley and Simon Riggs, reviewed by KaiGai Kohei, Heikki
Linnakangas, Haribabu Kommi, and me.
21 files changed:
doc/src/sgml/ref/create_aggregate.sgml
src/backend/catalog/pg_aggregate.c
src/backend/commands/aggregatecmds.c
src/backend/commands/explain.c
src/backend/executor/nodeAgg.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/prep/prepunion.c
src/backend/parser/parse_agg.c
src/bin/pg_dump/pg_dump.c
src/include/catalog/catversion.h
src/include/catalog/pg_aggregate.h
src/include/nodes/execnodes.h
src/include/nodes/plannodes.h
src/include/optimizer/planmain.h
src/include/parser/parse_agg.h
src/test/regress/expected/create_aggregate.out
src/test/regress/sql/create_aggregate.sql