[PATCH] Fix hash join costing when the inner side is provably unique
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.
Hi,
Attached is v2.
Changes since v1:
- Rebased onto master 11591f273e6a (2026-11-17).
- Update contrib/pg_plan_advice/expected/gather.out: the corrected
costing changes the plan recorded there from a parallel hash join to
a merge join. make check and check-world pass with the update.
The costing logic itself is unchanged.
Regards,
He Kuang