Join vs. sub-query
I am an old-school MySQL user and have always preferred
JOIN
over sub-query. But nowadays everyone uses sub-query and I hate it, I don't know why.
I lack the theoretical knowledge to judge for myself if there is any difference. Is a sub-query as good as a
JOIN
and therefore there is nothing to worry about?Answer:
Taken from the manual (14.2.10.11 Rewriting Subqueries as Joins):
A LEFT [OUTER] JOIN can be faster than an equivalent subquery because the server might be able to optimize it better—a fact that is not specific to MySQL Server alone.
So subqueries can be slower than LEFT [OUTER] JOINS, but in my opinion their strength is slightly higher readability.
http://stackoverflow.com/questions/2577174/join-vs-sub-query