Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Jun 21, 2021 at 1:38 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> NestLoop Join
>> Join Filter: t1.x op t2.y
>> -> Index Scan on t1_pkey
>> Index Cond: t1.id = constant
>> -> Seq Scan on t2
> Hmm, yeah, I guess that's possible. How much do you think this loses
> as compared with:
> Hash Join
> Hash Cond: t1.x op t2.y
> -> Seq Scan on t2
> -> Hash
> -> Index Scan on t1_pkey
Hard to say. The hash overhead might or might not pay for itself.
If the equality operator proper is expensive and we get to avoid
applying it at most t2 rows, then this might be an OK alternative;
otherwise not so much.
In any case, the former looks like plans that we generate now,
the second not. Do you really want to field a lot of questions
about why we suddenly changed to a not-clearly-superior plan?
regards, tom lane