SQL join performance operation order
Some common optimization techniques to improve your queries are here:
-
Index
the columns used in joining. If they areforeign keys
, normally databases likeMySql
already index them. -
Index
thecolumns
used inconditions
orWHERE
clause. - Avoid
*
and explicitly select the columns that you really need. - The order of joining in most of the cases won't matter, because
DB-Engines
are inteligent enough to decide that.
So its better to analyze your structure of both the joining tables, have indexes in place.
And if anyone is further intrested, how changing conditions
order can help getting the better performance. I've a detailed answer over here mysql Slow query issue.