Re: BUG #16104: Invalid DSA Memory Alloc Request in Parallel Hash
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: James Coleman <jtc331@gmail.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2019-11-10T22:07:01Z
Lists: pgsql-bugs
On Mon, Nov 11, 2019 at 10:38 AM James Coleman <jtc331@gmail.com> wrote: > But now we're at the end of my understanding of how hash tables and > joins are implemented in PG; is there a wiki page or design that might > give me some current design description of how the buckets and batches > work with the hash so I can keep following along? We have something like the so-called "Grace" hash join (with the "hybrid" refinement, irrelevant for this discussion): https://en.wikipedia.org/wiki/Hash_join#Grace_hash_join Our word "batch" just means partition. Most descriptions talk about using two different hash functions for partition and bucket, but our implementation uses a single hash function, and takes some of the bits to choose the bucket and some of the bits to choose the batch. That happens here: https://github.com/postgres/postgres/blob/master/src/backend/executor/nodeHash.c#L1872
Commits
-
Rotate instead of shifting hash join batch number.
- 5c0a132cf141 9.4.26 landed
- 893eaf0be8be 9.5.21 landed
- 15861deb65cd 9.6.17 landed
- 8e89bc6dfd3d 10.12 landed
- 9e551a14cb45 11.7 landed
- 8052aaf521e4 12.2 landed
- e69d64454778 13.0 landed