> | 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@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026