pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Broersma Jr <rabroersma@yahoo.com>
To: Medi Montaseri <montaseri@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: WHERE clause OR vs IN
Date: Wed, 12 Dec 2007 16:37:45 -0800 (PST)
Message-ID: <359993.87392.qm@web31808.mail.mud.yahoo.com> (raw)
In-Reply-To: <8078a1730712121530r70a520e1qf9c09b516db54b0e@mail.gmail.com>

--- On Wed, 12/12/07, Medi Montaseri <montaseri@gmail.com> wrote:
 
> based on your report, run time of OR is 0.275 ms and IN is
> 0.314
>
> > postgres=# explain analyze select * from tellers where
> bid in ('1','2');
 
Two other options are:

SELECT *
  FROM Tellers
 WHERE bin = ANY( '1', '2' );

and

    SELECT T.*
      FROM Tellers AS T
INNER JOIN ( VALUES ( '1' ), ( '2' ) ) AS B( bin )
        ON T.bin = B.bin;

Regards,
Richard Broersma Jr.



view thread (7+ messages)  latest in thread

Message-ID: <359993.87392.qm@web31808.mail.mud.yahoo.com>
Permalink:  ../359993.87392.qm@web31808.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/359993.87392.qm@web31808.mail.mud.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: rabroersma@yahoo.com, montaseri@gmail.com
  Subject: Re: WHERE clause OR vs IN
  In-Reply-To: <359993.87392.qm@web31808.mail.mud.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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