Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

WHERE clause OR vs IN



Hi,

I know this is not exactly admin related, but ... it is simple enough to be even fun

From a performance point of view, is it better to use OR as in
SELECT expr FROM expr WHERE col=this OR col=that OR col=theOther
Or to use a range of values as in
SELECT expr FROM expr WHERE col in ( val1, val2, ...., valn)

I think the IN range yields a better query plan .... what do you think ?
Thanks
Medi


Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group