Re: Avoiding sequential scans with OR join condition

Поиск
Список
Период
Сортировка
Искать
От
Mike Mascari
Тема
Re: Avoiding sequential scans with OR join condition
Дата
Msg-id
4172193D.8030202@mascari.com
Ответ на
Список
Дерево обсуждения
Avoiding sequential scans with OR join condition Mike Mascari <mascarm@mascari.com>
Re: Avoiding sequential scans with OR join condition Sim Zacks <sim@compulab.co.il>
Re: Avoiding sequential scans with OR join condition Mike Mascari <mascarm@mascari.com>
Re: Avoiding sequential scans with OR join condition Mike Mascari <mascarm@mascari.com>
Re: Avoiding sequential scans with OR join condition Sim Zacks <sim@compulab.co.il>
Re: Avoiding sequential scans with OR join condition Bruno Wolff III <bruno@wolff.to>
Re: Avoiding sequential scans with OR join condition Martijn van Oosterhout <kleptog@svana.org>
Re: Avoiding sequential scans with OR join condition Janning Vygen <vygen@gmx.de>
Re: Avoiding sequential scans with OR join condition Tom Lane <tgl@sss.pgh.pa.us>
Sim Zacks wrote:
> I would use 2 left joins and use the where condition to make sure one
> of them is true, such as:
> 
> select big_table.* from
> big_table left join little_table as l1 on big_table.y1=l1.y and
> l1.x=10
> left join little_table as l2 on big_table.y2=l2.y and l1.x=10
> where l1.p_key is not null and l2.p_key is not null
> 
> I have never tried this in postgresql, but in my experience with
> various other DB engines it is a lot faster then using an or in the
> join and faster then a union.

Wow! Thanks! That certainly did the trick.

Mike Mascari
В списке pgsql-general по дате отправления
От: Sim Zacks
Дата:
От: Mike Mascari
Дата:
FAQ