OR or IN ?

From: Luca Ferrari <fluca1978(at)infinito(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: OR or IN ?
Date: 2008-10-14 06:33:21
Message-ID: 200810140833.21911.fluca1978@infinito.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,
I've got a query with a long (>50) list of ORs, like the following:

SELECT colB, colC FROM table WHERE colA=X OR colA=Y OR colA=Z OR ....

Is there any difference in how postgresql manages the above query and the
following one?

SELECT colB, colC FROM table WHERE colA IN (X,Y,Z,...)

Which is the suggested index to use on colA to get better performances?

Thanks,
Luca

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2008-10-14 06:48:31 Re: OR or IN ?
Previous Message Craig Ringer 2008-10-14 06:21:07 Re: pg_hotbackup how to