For example:
SELECT * FROM table_1 LIMIT 5
LEFT JOIN table_2 AS table_1.id = table_2.id
WHERE 1
Otherwise the engine takes all of table_1 before applying the join, then limiting which can slow the query down massively (with massive tables).
You can do it by joining on a subquery instead of an actual table. Something like this should work:
SELECT * FROM
(SELECT * FROM table_1 LIMIT 5) as subq
LEFT JOIN table_2 ON subq.id = table_2.id WHERE 1
来源:https://stackoverflow.com/questions/7405432/can-you-apply-limit-on-mysql-before-left-join-another