0
我运行两个SQL查询说,SQL嵌套查询优化
select obname from table1 where obid = 12
select modname from table2 where modid = 12
两者都采取非常短的时间,说每300毫秒。
但是当我运行:
select obname, modname
from (select obname from table1 where obid = 12) as alias1,
(select modname from table2 where modid = 12) as alias2
它正在3500ms。为什么这样?
这两个查询返回多少行? –
首先,您将2个查询与1进行比较,执行查询不像苹果只是将时间加在一起并完成 – Mihai
为什么不使用'UNION ALL' –