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 <[email protected]>
Co-authored-by: Tom Lane <[email protected]>
Discussion: 
https://postgr.es/m/cagrkxqtgugmyrtnp_11njl_gcxwafzvfm5wkunfsfzozxdf...@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(-)

Reply via email to