Re: Where clause efficiency using "IN"

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Where clause efficiency using "IN"
Дата
Msg-id 1098459735.21035.97.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Where clause efficiency using "IN"  (Sean Davis <sdavis2@mail.nih.gov>)
Список pgsql-novice
On Fri, 2004-10-22 at 09:07, Sean Davis wrote:
> Just a quick general question:  Can someone comment on using where
> clauses like:
>
> (sample = 2 OR sample = 3 OR sample = 4)
>
> as compared to
>
> sample in (2,3,4)
>
> in terms of efficiency?

I believe they are pretty much the same, in that the planner will turn
the in clause you have there into a series of ors.  However, if it is a
subselect, then the planner can use a hashed aggregate method, as long
as the dataset can fit into memory, as defined by some setting, (I think
it's sort_mem, but I'm not completely sure).


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

Предыдущее
От: Steven Klassen
Дата:
Сообщение: Re: Where clause efficiency using "IN"
Следующее
От: Eric Bieschke
Дата:
Сообщение: User-defined type arrays?