pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feed"IN" or "=" and "OR"
2+ messages / 2 participants
[nested] [flat]
* "IN" or "=" and "OR"
@ 2003-01-11 18:51 Vernon Wu <vernonw@gatewaytech.com>
0 siblings, 1 reply; 2+ messages in thread
From: Vernon Wu @ 2003-01-11 18:51 UTC (permalink / raw)
To: pgsql-performance
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.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: "IN" or "=" and "OR"
@ 2003-01-12 04:10 Tom Lane <tgl@sss.pgh.pa.us>
parent: Vernon Wu <vernonw@gatewaytech.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2003-01-12 04:10 UTC (permalink / raw)
To: vernonw@gatewaytech.com; +Cc: pgsql-performance
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-01-12 04:10 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-11 18:51 "IN" or "=" and "OR" Vernon Wu <vernonw@gatewaytech.com>
2003-01-12 04:10 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox