【发布时间】:2017-10-26 13:22:22
【问题描述】:
为什么要查询:
select sum(column_2) from table1 where column_1 in
(select column_1 from table2 where column_3 = 'foo');
需要几分钟才能执行,所以如果我单独执行两个查询会更快吗?
例如:
select column_1 from table2 where column_3 = 'foo' 结果 xxx
select sum(column_2) from table1 where column_1 in (xxx);
【问题讨论】:
-
共享执行计划怎么样? (
EXPLAIN EXTENDED) -
单独执行它们只会执行 2 个查询。将一个作为嵌套子查询执行会为父查询的每一行执行它。
标签: mysql performance in-clause