Skip navigation links

MySQL Forums :: Optimizer & Parser :: INNER JOIN (WHERE) vs LEFT JOIN


Advanced Search

INNER JOIN (WHERE) vs LEFT JOIN
Posted by: Veny ()
Date: November 02, 2005 08:12PM

Hi,

Could anyone point me a reference on information related to JOIN operations?
E.g. if i wrote the following sql:
SELECT * FROM Table1, Table2 WHERE Table1.columnA = Table2.columnB AND Table1.columnA = 5;

Does MySQL filters all record of Table1 with columnA's value equals to 5, and then perform JOIN? Or JOIN is perform first before filtering out the values?
I just would to understand on the performance of the query. Instictively, the first option would be faster.

Secondly, compare the two SQLs:
SELECT * FROM Table1, Table2 WHERE Table1.columnA = Table2.columnB;
and
SELECT * FROM Table1 LEFT JOIN Table2 ON Table1.columnA = Table2.columnB;

Which would be executed faster? I understand the 2 SQLs have different function. LEFT JOIN should used for scenario if not all record of Table1.columnA exist in Table2.columnB. But assuming it does, which query would be faster?

Thanks much.

Veny

Options: ReplyQuote


Subject Views Written By Posted
INNER JOIN (WHERE) vs LEFT JOIN 85661 Veny 11/02/2005 08:12PM
Re: INNER JOIN (WHERE) vs LEFT JOIN 23893 Sergey Petrunya 11/03/2005 05:18AM
Re: INNER JOIN (WHERE) vs LEFT JOIN 23150 Sergey Petrunya 11/03/2005 05:26AM


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.