MySQL Forums
Forum List  »  Optimizer & Parser

LEFT JOIN Optimization
Posted by: Ram R
Date: August 21, 2007 03:04PM

Hey,

I was wondering if the WHERE condition is applied after the join or before the join. It makes sense that MySQL should do apply the condition before the JOIN but I wanted to make sure.

Here is a sample query:

SELECT user.id FROM
user
LEFT JOIN
(
SELECT blocked_id FROM blocked_users WHERE blocked_id = 34
UNION
SELECT blocked_id FROM blocked_users WHERE blocked_id = 38
) AS t
ON user.id = t.id
WHERE user.group = 40
AND t.id IS NULL;

Options: ReplyQuote


Subject
Views
Written By
Posted
LEFT JOIN Optimization
7783
August 21, 2007 03:04PM
3813
August 21, 2007 06:45PM
3362
August 21, 2007 11:32PM
3311
August 29, 2007 07:19PM


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.