Re: Hash vs. HashJoin nodes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hash vs. HashJoin nodes
Date: 2005-03-31 05:03:37
Message-ID: 2135.1112245417@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway <neilc(at)samurai(dot)com> writes:
> I think this tweak would be universally better than the existing code.

Yes, but you miss the point: there's a case where the existing code
isn't good and you aren't improving it. Specifically, where the inner
query has high startup cost and the outer query is empty. If you'd
pulled from the outer query first then you could avoid the inner startup
cost.

>> This could all get pretty hairy when you consider that it has to still
>> work for left joins too ...

> Right; I was planning to bail and only do this for inner joins.

Well, for outer joins the optimal strategy is simple: pull from the
outer query first. If it's empty then you needn't touch the inner
query at all. Otherwise you have to build the hash table.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-03-31 05:19:08 Re: Notes on lock table spilling
Previous Message Neil Conway 2005-03-31 04:53:51 Re: Hash vs. HashJoin nodes