Which query is good - IN or OR

From: AI Rumman <rummandba(at)gmail(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Which query is good - IN or OR
Date: 2010-12-09 09:25:43
Message-ID: AANLkTik0Scd+2=onn91=9Et11+fBsxQBAvHt7iD+OuEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

A simple query I can write in any of the following two ways:

1.
Select col1
from table
where col2 in ('A','B');

2.
Select col1
from table
where
col2 = 'A'
or col2 = 'B'

Here IN condition may be more than two.
I need to know which one is good for good performance.

Any idea please.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2010-12-09 09:51:46 Re: Which query is good - IN or OR
Previous Message Ivano Luberti 2010-12-09 08:58:09 Re: Implement online database using Postgresql