Andres Freund <and...@anarazel.de> writes: > On 2024-12-08 09:23:42 +0700, Andrei Lepikhov wrote: >> I think avoiding touching a hash table and an index under MergeJoin can also >> be beneficial.
> How would you get significant wins for mergejoins? You need to go through both > inner and outer anyway? Yeah, sounds like nonsense to me too. The reason this can be a win for nestloop is that we perform a new scan of the inner relation for each outer row, and if we can skip an inner scan altogether then we're ahead. But mergejoin and hashjoin only scan each input once anyway, so I see no opportunity to save any scan work. It's barely possible that this is interesting for hash join because you could save scanning a hash list ... but frankly I don't believe there could be enough win there to justify additional mechanism. Hash join is in a world of hurt already if there are lots of duplicate hash codes. regards, tom lane