pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Emit null-keyed hash join outer tuples immediately when feasible
Date: Fri, 23 Oct 2026 15:35:47 +0000
Message-ID: <E1xKHJ5-00000000T24-1koa@gemulon.postgresql.org> (raw)

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@gmail.com>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.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(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1xKHJ5-00000000T24-1koa@gemulon.postgresql.org>
Permalink:  ../E1xKHJ5-00000000T24-1koa@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xKHJ5-00000000T24-1koa@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Emit null-keyed hash join outer tuples immediately when feasible
  In-Reply-To: <E1xKHJ5-00000000T24-1koa@gemulon.postgresql.org>
  References: <E1xKHJ5-00000000T24-1koa@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