中国开发网: 论坛: 程序员情感CBD: 贴子 503468
haitao
我用mssql的经验,有合适索引的情况下,感觉join on代替in/not in是会快很多
join要求的索引是很明显的,一般人都会建

以前就纳闷过,既然这样,数据库内部干脆自动把in转为join好了
也许的确如db说的,还有一定的前提条件

select * from tba where f1 in (select f1 from tbb where ....)
==>
select a.* from tba a
left join tba b on a.f1=b.f1
where b.原来的限制
and b.f1 is not null

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录