pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Rotate instead of shifting hash join batch number.
Date: Tue, 24 Dec 2019 00:22:22 +0000
Message-ID: <E1ijXxu-0006Wu-6T@gemulon.postgresql.org> (raw)

Rotate instead of shifting hash join batch number.

Our algorithm for choosing batch numbers turned out not to work
effectively for multi-billion key inner relations.  We would use
more hash bits than we have, and effectively concentrate all tuples
into a smaller number of batches than we intended.  While ideally
we should switch to wider hashes, for now, change the algorithm to
one that effectively gives up bits from the bucket number when we
don't have enough bits.  That means we'll finish up with longer
bucket chains than would be ideal, but that's better than having
batches that don't fit in work_mem and can't be divided.

Batch-patch to all supported releases.

Author: Thomas Munro
Reviewed-by: Tom Lane, thanks also to Tomas Vondra, Alvaro Herrera, Andres Freund for testing and discussion
Reported-by: James Coleman
Discussion: https://postgr.es/m/16104-dc11ed911f1ab9df%40postgresql.org

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9e551a14cb45e1240af4978b44d2b7c1c649482e

Modified Files
--------------
src/backend/executor/nodeHash.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1ijXxu-0006Wu-6T@gemulon.postgresql.org>
Permalink:  ../E1ijXxu-0006Wu-6T@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ijXxu-0006Wu-6T@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: tmunro@postgresql.org
  Subject: Re: pgsql: Rotate instead of shifting hash join batch number.
  In-Reply-To: <E1ijXxu-0006Wu-6T@gemulon.postgresql.org>
  References: <E1ijXxu-0006Wu-6T@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