| 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