pgsql: Emit null-keyed hash join outer tuples immediately when feasible

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Emit null-keyed hash join outer tuples immediately when feasible
Date: 2026-10-23 15:35:47
Message-ID: E1xKHJ5-00000000T24-1koa@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Emit null-keyed hash join outer tuples immediately when feasible.

Commit 1811f1af9 put outer tuples with null join keys into a
tuplestore and emitted them at the end of the batch, which risks
expensive spills to disk if there are a lot of them. It's difficult
to avoid the tuplestore in a multi-batch parallel join. But in the
non-parallel and single-batch cases we can just emit such tuples
immediately, at the tiny cost of propagating the "is-null" result
flag one call level further up. This avoids a performance regression
from v18 for such cases.

Author: shihao zhong <zhong950419(at)gmail(dot)com>
Co-authored-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/CAGRkXqTgugmYrtnP_11NjL_GCXwAfzVfm5WKUNFsfZOzxDF2rA@mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/126976a8ffcfa47f40d3df09243ebf4606001912

Modified Files
--------------
src/backend/executor/nodeHashjoin.c | 62 +++++++++++++++++++++++--------------
src/include/executor/hashjoin.h | 11 ++++---
src/include/nodes/execnodes.h | 3 +-
3 files changed, 47 insertions(+), 29 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2026-10-23 19:05:11 pgsql: doc PG 18 relnotes: add incompatibility item about SQLSTATE
Previous Message Tom Lane 2026-10-23 14:29:55 pgsql: Remove faulty Asserts added by 1999fe227.