From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Re: Does PostgreSQL support EXISTS? |
Date: | 2001-06-13 09:50:11 |
Message-ID: | 20010613195011.A31062@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Jun 13, 2001 at 09:21:02AM +0200, Michael Meskes wrote:
> On Wed, Jun 13, 2001 at 12:23:15PM +1000, Martijn van Oosterhout 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.
Huh? Since they do the same thing should they (in theory) run in the same
time.
Now, I can imagine most DBMSs would optimes the latter better than the
forward, but that doesn't change the theory. In theory someone should be
able to program postgres' rule rewrite to rewrite the former to the latter
and then they would execute identically.
--
Martijn van Oosterhout <kleptog(at)svana(dot)org>
http://svana.org/kleptog/
From | Date | Subject | |
---|---|---|---|
Next Message | Carfield Yim | 2001-06-13 09:58:02 | Newbie question: How to check how many tables avaliable at that database? |
Previous Message | Allan Kamau | 2001-06-13 09:36:15 | PLPGSQL: Using Transactions and locks |