haitao:
我用mssql的经验,有合适索引的情况下,感觉join on代替in/not in是会快很多
[阅读: 487] 2007-04-23 04:09:40
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