Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在阅读 MySQL 连接命令的文档时,看起来所有这些joins都类似于,通过简单地找到笛卡尔积然后从该结果中进行选择。 这是一个准确的假设吗? 我是否应该编写自己的子查询并从中进行选择?
joins
,
从逻辑上讲,您是正确的,联接是经过过滤的笛卡尔积;但实际上 DBMS 查询处理器比这更聪明。
您需要查看展示计划或解释以了解它在幕后所做的事情。
假设查询管理器比您更了解如何创建快速可靠的查询计划,不要预先优化。