RE: Re: Does PostgreSQL support EXISTS?

From: "Erick Papadakis" <erick_papadakis(at)yahoo(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Nils Zonneveld" <nils(at)mbit(dot)nl>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: RE: Re: Does PostgreSQL support EXISTS?
Date: 2001-06-13 12:22:11
Message-ID: LPBBKJENENLIHFCGAPOIGEBOHAAA.erick_papadakis@yahoo.com
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).

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexey Borzov 2001-06-13 12:33:40 Re[2]: Re: very big problem with NULL
Previous Message Alla 2001-06-13 12:12:45 Re: Unix time stamp function?