Here is MySQL's nested outer joins optimization cheat sheet:
- Conversions:
- RIGHT JOIN is converted to LEFT JOIN. FULL JOIN is not supported.
- Outer joins are converted to inner joins when possible
- Constraints on join order:
- "Outer tables go first"
- "No interleaving"
- Table access rules:
- "Inner" table access methods are constructed from parts of the ON condition. WHERE condition can't be used to construct table accesses.
- Parts of ON condition are checked as soon as possible
- Parts of the WHERE condition
- are not checked until we've found a row combination that matches the ON clause
- are checked as soon as possible after that.
Or, in more detail:
…
[Read more]