Обсуждение: "IN" or "=" and "OR"

Поиск
Список
Период
Сортировка

"IN" or "=" and "OR"

От
Vernon Wu
Дата:
Which query statement is better in terms of preformance ?

select ... from table1 where field1 in  ('a', 'b', 'c')

select ... from table1 where field1='a' or field1='b' or field1='c'

Thanks.



Re: "IN" or "=" and "OR"

От
Tom Lane
Дата:
Vernon Wu <vernonw@gatewaytech.com> writes:
> Which query statement is better in terms of preformance ?
> select ... from table1 where field1 in  ('a', 'b', 'c')
> select ... from table1 where field1='a' or field1='b' or field1='c'

There is no difference, other than the microseconds the parser spends
transforming form 1 into form 2 ...

            regards, tom lane