开发者

Are all MySQL joins selections on the Cartesian product?

开发者 https://www.devze.com 2023-01-19 11:39 出处:网络
On reading the documentation of the MySQL join commands, it looks like all the joins are analogous to , by simply finding the Cartesian product and then selecting from that result.

On reading the documentation of the MySQL join commands, it looks like all the joins are analogous to , by simply finding the Cartesian product and then selecting from that result.

Is this an accurate assumption?

Should I instead write my own sub-queries and开发者_Go百科 select from those?


Logically you are correct, joins are Cartesian products that are filtered; but practically the DBMS query processor is smarter than that.

You would need to look at a show plan or explain to see what it is doing under the covers.

Assume that the Query Manager knows more than you do about how to create a fast and solid query plan, don't pre-optimize.

0

精彩评论

暂无评论...
验证码 换一张
取 消