Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> Upon further review, it appears that a big part of this problem is
> that cost_hashjoin() doesn't understand that it needs cost semi-joins
> differently from inner or left joins.
Yeah, I have a note to look into that before 8.4 final. The same is
true for nestloops: stopping after hitting one match to the current
outer can make a big difference, and that's not reflected in costsize.c
yet. I'm not sure whether cost_mergejoin needs to care.
regards, tom lane