How should we determine which conditions to place in ON clause and which of them to place in WHERE clause in a mysql query. And which of them execute faster?
Most of the time is the same thing as Mysql Query Optimizer does the internal optimization and joins are basically extra conditions. You can also benchmark or use EXPLAIN/DESCRIBE to see how the query is actually executed and what is the query execution plan .
They are not the same.
As I know, when you are joining tables using WHERE
clause, MySQL will join them with the general join algorithm. If you need to do LEFT JOIN
, RIGHT JOIN
or any other type of join, you need to define it explictly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.