[PATCH] Fix hash join costing when the inner side is provably unique

From: He Kuang <hekuang(dot)git(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, he kuang <hekuang(dot)git(at)gmail(dot)com>
Subject: [PATCH] Fix hash join costing when the inner side is provably unique
Date: 2026-11-13 12:51:54
Message-ID: CAC5HyryDtq_CaL5v4k+t3vGMBYeJVUVoB5sC9vp4oceK0xfWgQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

Attached is a standalone fix for hash join costing when the inner side
is provably unique. compute_semi_anti_join_factors() asks
clauselist_selectivity() with the join's own SpecialJoinInfo, so
eqjoinsel() returns ordinary equality selectivity instead of the
semi-join selectivity; separately, an inner-unique plain inner join
should charge hashjointuples on the joinrel row estimate, not
outer_matched_rows. It follows db2d9932 (Richard Guo) but has no
dependency on any other patch, applies cleanly to master 13eb5640
(2026-11-13), and passes make check 243/243.

Comments welcome.

Attachment Content-Type Size
fix-hash-join-costing-inner-unique.patch text/plain 9.6 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Rafia Sabih 2026-11-13 13:03:48 Semi-join related bug in postgres_fdw
Previous Message João Rito 2026-11-13 12:17:22 Re: [PATCH] Add recovery boundary WAL record for database and tablespace commands