Re: Hash vs. HashJoin nodes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Hash vs. HashJoin nodes
Дата
Msg-id 2135.1112245417@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Hash vs. HashJoin nodes  (Neil Conway <neilc@samurai.com>)
Ответы Re: Hash vs. HashJoin nodes  ("Jim C. Nasby" <decibel@decibel.org>)
Список pgsql-hackers
Neil Conway <neilc@samurai.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Hash vs. HashJoin nodes
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Notes on lock table spilling