Re: Re: Does PostgreSQL support EXISTS?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Erick Papadakis <erick_papadakis(at)yahoo(dot)com>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Nils Zonneveld <nils(at)mbit(dot)nl>, pgsql-general(at)postgresql(dot)org
Subject: Re: Re: Does PostgreSQL support EXISTS?
Date: 2001-06-13 14:03:58
Message-ID: 200106131403.f5DE3wE03678@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David M. Richter 2001-06-13 14:09:31 Posgres 7.1.2 and IRIX 6.4
Previous Message Bruce Momjian 2001-06-13 14:03:24 Re: Re: Does PostgreSQL support EXISTS?