pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <rhodiumtoad@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Support hashed aggregation with grouping sets.
Date: Mon, 27 Mar 2017 03:47:00 +0000
Message-ID: <E1csLcS-0002co-Ef@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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(-)


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


view thread (3+ messages)  latest in thread

Message-ID: <E1csLcS-0002co-Ef@gemulon.postgresql.org>
Permalink:  ../E1csLcS-0002co-Ef@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1csLcS-0002co-Ef@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: rhodiumtoad@postgresql.org
  Subject: Re: pgsql: Support hashed aggregation with grouping sets.
  In-Reply-To: <E1csLcS-0002co-Ef@gemulon.postgresql.org>
  References: <E1csLcS-0002co-Ef@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox