Thread: "IN" or "=" and "OR"

"IN" or "=" and "OR"

From
Vernon Wu
Date:
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"

From
Tom Lane
Date:
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