pgsql: Support multi-stage aggregation. - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: Support multi-stage aggregation.
Date
Msg-id E1aLy5X-0002Px-Ga@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a7de3dc5c346e07e0439275982569996e645b3c2

Modified Files
--------------
doc/src/sgml/ref/create_aggregate.sgml         |   16 +-
src/backend/catalog/pg_aggregate.c             |   38 ++-
src/backend/commands/aggregatecmds.c           |    4 +
src/backend/commands/explain.c                 |   46 ++--
src/backend/executor/nodeAgg.c                 |  333 ++++++++++++++++++++----
src/backend/nodes/copyfuncs.c                  |    2 +
src/backend/nodes/outfuncs.c                   |    3 +
src/backend/nodes/readfuncs.c                  |    2 +
src/backend/optimizer/plan/createplan.c        |    9 +-
src/backend/optimizer/plan/planner.c           |    8 +
src/backend/optimizer/prep/prepunion.c         |    2 +
src/backend/parser/parse_agg.c                 |   36 +++
src/bin/pg_dump/pg_dump.c                      |   30 ++-
src/include/catalog/catversion.h               |    2 +-
src/include/catalog/pg_aggregate.h             |  306 +++++++++++-----------
src/include/nodes/execnodes.h                  |    2 +
src/include/nodes/plannodes.h                  |    2 +
src/include/optimizer/planmain.h               |    5 +-
src/include/parser/parse_agg.h                 |    5 +
src/test/regress/expected/create_aggregate.out |   18 ++
src/test/regress/sql/create_aggregate.sql      |   17 ++
21 files changed, 652 insertions(+), 234 deletions(-)


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: PostgresNode: Add names to nodes
Next
From: Robert Haas
Date:
Subject: pgsql: Support parallel joins, and make related improvements.