Re: WHERE clause OR vs IN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- On Wed, 12/12/07, Medi Montaseri <montaseri@xxxxxxxxx> 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.

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux