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@svana.org>
http://svana.org/kleptog/