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

From Martijn van Oosterhout
Subject Re: Re: Does PostgreSQL support EXISTS?
Date
Msg-id 20010613122315.A30069@svana.org
Whole thread Raw
In response to Re: Does PostgreSQL support EXISTS?  (Nils Zonneveld <nils@mbit.nl>)
Responses Re: Re: Does PostgreSQL support EXISTS?  (Michael Meskes <meskes@postgresql.org>)
RE: Re: Does PostgreSQL support EXISTS?  ("Erick Papadakis" <erick_papadakis@yahoo.com>)
Re: Re: Does PostgreSQL support EXISTS?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Wed, Jun 06, 2001 at 10:44:04PM +0200, Nils Zonneveld wrote:
>
>
> Raymond Chui wrote:
> >
> > The Subject says its all.
> >
>
> Yes 'exists' works (though I never understood the advantage to the 'in' operator).

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.
--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/

pgsql-general by date:

Previous
From: Steve Micallef
Date:
Subject: Unix time stamp function?
Next
From: Zak McGregor
Date:
Subject: OIDS in views