pgsql: Support hashed aggregation with grouping sets.

Started by Andrew Gierthover 9 years ago3 messagescomitters
Jump to latest
#1Andrew Gierth
andrew@tao11.riddles.org.uk

Support hashed aggregation with grouping sets.

This extends the Aggregate node with two new features: HashAggregate
can now run multiple hashtables concurrently, and a new strategy
MixedAggregate populates hashtables while doing sorted grouping.

The planner will now attempt to save as many sorts as possible when
planning grouping sets queries, while not exceeding work_mem for the
estimated combined sizes of all hashtables used. No SQL-level changes
are required. There should be no user-visible impact other than the
new EXPLAIN output and possible changes to result ordering when ORDER
BY was not used (which affected a few regression tests). The
enable_hashagg option is respected.

Author: Andrew Gierth
Reviewers: Mark Dilger, Andres Freund
Discussion: /messages/by-id/87vatszyhj.fsf@news-spur.riddles.org.uk

Branch
------
master

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 61 +-
src/backend/commands/explain.c | 25 +-
src/backend/executor/nodeAgg.c | 861 +++++++++++++++++--------
src/backend/lib/Makefile | 4 +-
src/backend/lib/knapsack.c | 114 ++++
src/backend/nodes/bitmapset.c | 30 +
src/backend/nodes/outfuncs.c | 34 +-
src/backend/optimizer/path/costsize.c | 7 +-
src/backend/optimizer/plan/createplan.c | 83 +--
src/backend/optimizer/plan/planner.c | 861 ++++++++++++++++++++-----
src/backend/optimizer/util/pathnode.c | 150 +++--
src/include/lib/knapsack.h | 17 +
src/include/nodes/bitmapset.h | 6 +
src/include/nodes/execnodes.h | 21 +-
src/include/nodes/nodes.h | 5 +-
src/include/nodes/plannodes.h | 2 +-
src/include/nodes/relation.h | 30 +-
src/include/optimizer/pathnode.h | 4 +-
src/test/regress/expected/groupingsets.out | 616 +++++++++++++++++-
src/test/regress/expected/tsrf.out | 50 +-
src/test/regress/sql/groupingsets.sql | 155 ++++-
src/test/regress/sql/tsrf.sql | 2 +
22 files changed, 2544 insertions(+), 594 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2Andrew Gierth
andrew@tao11.riddles.org.uk
In reply to: Andrew Gierth (#1)
Re: pgsql: Support hashed aggregation with grouping sets.

"Andrew" == Andrew Gierth <rhodiumtoad@postgresql.org> writes:

Andrew> Support hashed aggregation with grouping sets.

Looks like some regression test plans aren't as stable as I hoped. On it.

--
Andrew (irc:RhodiumToad)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Gierth (#1)
Re: pgsql: Support hashed aggregation with grouping sets.

Andrew Gierth <rhodiumtoad@postgresql.org> writes:

Support hashed aggregation with grouping sets.

Looks like this needs a bit more work to ensure the plans chosen
for the regression test examples are stable ...

regards, tom lane

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers