+ -
当前位置:首页 → 问答吧 → MySQL subquery 次序与速度

MySQL subquery 次序与速度

时间:2014-04-20

来源:互联网

小弟发觉相同的 subquery 但次序不同, 速度可以差好远, 例如:

SQL1 fast:
select x, sum(y) from table1 where A and B and x in (select x from table2 where C order by x) group by x order by x;

SQL2 slow:
select x, sum(y) from table1 where x in (select x from table2 where C order by x) and A and B group by x order by x;

请问有冇朋友知点解? 唔该晒.

作者: footballr   发布时间: 2014-04-20

keyword "INDEX FAST FULL SCAN"

作者: alanlam   发布时间: 2014-04-20