RE: Re: Does PostgreSQL support EXISTS? - Mailing list pgsql-general

From Erick Papadakis
Subject RE: Re: Does PostgreSQL support EXISTS?
Date
Msg-id LPBBKJENENLIHFCGAPOIGEBOHAAA.erick_papadakis@yahoo.com
Whole thread Raw
In response to Re: Re: Does PostgreSQL support EXISTS?  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Re: Does PostgreSQL support EXISTS?  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-general
    | On postgres at least, exists is faster than in.
    |
    | They are equivalent though.
    |
    | select x from a where v in (select v from b)
    | select x from a where exists (select 1 from b where a.v = b.v)
    | select x from a, b where a.v = b.v
    |
    | are all the same. Postgres doesn't quite know that yet though.


If you do an EXPLAIN on Oracle with the first 2 queries above, you will
notice that the second one is faster in Oracle too (i.e., EXISTS is faster
than IN).

Cheers
Shanx


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.252 / Virus Database: 125 - Release Date: 09-May-01


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


pgsql-general by date:

Previous
From: "Andy Samuel"
Date:
Subject: Vacuum-ing without disconnecting users
Next
From: Alexey Borzov
Date:
Subject: Re[2]: Re: very big problem with NULL