Re: Re: Does PostgreSQL support EXISTS?

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: Does PostgreSQL support EXISTS?
Date: 2001-06-13 14:16:28
Message-ID: 20010613161628.A19951@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jun 13, 2001 at 10:03:24AM -0400, Bruce Momjian wrote:
> > > 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)
> >
> > The latter should be faster than the former on every relational database
> > system.
>
> That surprises me because the subquery is a correlated subquery which
> are usually slower on other databases that normal subqueries.

To be honest I didn't notice that. :-)

I was just talking about the difference with IN (where you have to compute
the complete result set) and EXISTS where you just look for one match.

Michael

--
Michael Meskes
Michael(at)Fam-Meskes(dot)De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2001-06-13 14:25:56 Re: copy/backup database
Previous Message David M. Richter 2001-06-13 14:09:31 Posgres 7.1.2 and IRIX 6.4