oracle 中not in 效率不高的问题
在oracle 中如果数据量大了。。使用not in会很慢因为会全表扫描
如下所示
select a1.mobile from atest a1 where a1.mobile NOT in
(select trim(a2.mobile2) from atest2 a2) )
如果 atest 中的数据大的时候 会变得非常慢
换成这样子 用not exists 会快一些
select a1.mobile from atest a1 where NOT EXISTS
(select trim(a2.mobile2) from atest2 a2 where trim(a1.mobile)= trim(a2.mobile2) )
本文探讨了在Oracle数据库中使用NOT IN操作符可能导致的性能问题,特别是当数据量较大时。通过对比,指出了使用NOT EXISTS替代NOT IN可以有效提高查询速度。
4157

被折叠的 条评论
为什么被折叠?



