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

From Bruce Momjian
Subject Re: Re: Does PostgreSQL support EXISTS?
Date
Msg-id 200106131403.f5DE3wE03678@candle.pha.pa.us
Whole thread Raw
In response to RE: Re: Does PostgreSQL support EXISTS?  ("Erick Papadakis" <erick_papadakis@yahoo.com>)
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).

So it is confirmed.  Interesting.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Re: Does PostgreSQL support EXISTS?
Next
From: Travis Bauer
Date:
Subject: 7.1.2 temporary file area