pgsql: Support hashed aggregation with grouping sets.

From: Andrew Gierth <rhodiumtoad(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Support hashed aggregation with grouping sets.
Date: 2017-03-27 03:47:00
Message-ID: E1csLcS-0002co-Ef@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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: https://postgr.es/m/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(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2017-03-27 04:04:41 pgsql: Fix a couple of problems in pg_get_statisticsextdef
Previous Message Michael Paquier 2017-03-27 02:20:17 Re: [COMMITTERS] pgsql: Show more processes in pg_stat_activity.