From LEFT JOIN and RIGHT JOIN Optimization
The join optimizer calculates the order in which tables should be joined.
MySQL implements an
Bis set to depend on table
Aand all tables on which
Ais set to depend on all tables (except
B) that are used in the
LEFT JOINcondition is used to decide how to retrieve rows from table
B. (In other words, any condition in the
WHEREclause is not used.)
- All standard join optimizations are performed, with the exception that a table is always read after all tables on which it depends. If there is a circular dependence, MySQL issues an error.
- All standard
WHEREoptimizations are performed.
- If there is a row in
Athat matches the
WHEREclause, but there is no row in
Bthat matches the
ONcondition, an extra
Brow is generated with all columns set to