Re: Avoiding sequential scans with OR join condition

Поиск
Список
Период
Сортировка
От Mike Mascari
Тема Re: Avoiding sequential scans with OR join condition
Дата
Msg-id 4172193D.8030202@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>)
Список pgsql-general
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
Дата:
Сообщение: Re: Avoiding sequential scans with OR join condition
Следующее
От: Mike Mascari
Дата:
Сообщение: Re: Avoiding sequential scans with OR join condition