pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Unbreak Finalize HashAggregate over Partial HashAggregate.
Date: Fri, 16 Dec 2016 15:11:13 +0000
Message-ID: <E1cHuAD-0005am-IG@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Unbreak Finalize HashAggregate over Partial HashAggregate.

Commit 5dfc198146b49ce7ecc8a1fc9d5e171fb75f6ba5 introduced the use
of a new type of hash table with linear reprobing for hash aggregates.
Such a hash table behaves very poorly if keys are inserted in hash
order, which does in fact happen in the case where a query use a
Finalize HashAggregate node fed (via Gather) by a Partial
HashAggregate node.  In fact, queries with this type of plan tend
to run effectively forever.

Fix that by seeding the hash value differently in each worker
(and in the leader, if it participates).

Andres Freund and Robert Haas

Branch
------
master

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

Modified Files
--------------
src/backend/executor/execGrouping.c       | 20 ++++++++++++++++++--
src/backend/executor/nodeAgg.c            |  3 ++-
src/backend/executor/nodeRecursiveunion.c |  3 ++-
src/backend/executor/nodeSetOp.c          |  3 ++-
src/backend/executor/nodeSubplan.c        |  6 ++++--
src/include/executor/executor.h           |  2 +-
src/include/nodes/execnodes.h             |  1 +
7 files changed, 30 insertions(+), 8 deletions(-)


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


Message-ID: <E1cHuAD-0005am-IG@gemulon.postgresql.org>
Permalink:  ../E1cHuAD-0005am-IG@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cHuAD-0005am-IG@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: rhaas@postgresql.org
  Subject: Re: pgsql: Unbreak Finalize HashAggregate over Partial HashAggregate.
  In-Reply-To: <E1cHuAD-0005am-IG@gemulon.postgresql.org>
  References: <E1cHuAD-0005am-IG@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