Re: In general, which of these queries would be faster?
Posted by:
Apachez
Date: April 27, 2006 04:36PM
In 4.1 and earlier the
t1, t2 WHERE t1.id = t2.id
is exactly the same as
t1 INNER JOIN t2 ON (t1.id = t2.id)
However since 5.0 this has changed a bit.
The change is that the t1, t2 WHERE t1.id = t2.id method has now lower execution priority than the other joins in the query.
Example...
If you mix t1, t2 WHERE t1.id = t2.id with a couple of LEFT JOINs the optimizer would see that the t1, t2 is actually an INNER JOIN and by performance excute this one first and then the LEFT JOINs (or the other way around depending on which index might exist etc).
But from 5.0 LEFT JOIN will ALWAYS be executed before t1, t2 WHERE t1.id = t2.id method (or rather t1, t2 will be ALWAYS excuted AFTER proper joins).
So if you want to keep performance in 5.0 and upwards you "should" rewrite your t1, t2 joins into "proper" t1 INNER JOIN t2 joins (unless someone changes this again in future)...
Subject
Views
Written By
Posted
1719
April 27, 2006 03:02PM
1084
April 27, 2006 03:23PM
Re: In general, which of these queries would be faster?
1047
April 27, 2006 04:36PM
1068
April 27, 2006 08:36PM
1065
April 28, 2006 08:29AM
990
April 28, 2006 02:29PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.