"IN" or "=" and "OR"

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

"IN" or "=" and "OR"

От:
Vernon Wu <vernonw@gatewaytech.com>
Дата:

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 <tgl@sss.pgh.pa.us>
Дата:
Vernon Wu  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
FAQ