日期:2014-05-17  浏览次数:21653 次

exists里面会走索引吗
假设在emp表的deptno列建了一个普通索引
在我执行:
SQL code

delete from scott.emp
 where empno > 7800
   and exists (select null
          from scott.dept
         where scott.dept. deptno = scott.emp.deptno);



在执行计划里发现没有走deptno上的索引,这是为什么?
假设走了索引在速度上会不会有很大提升(在emp、dept表数据量特别大的时候)。

------解决方案--------------------
没走索引可能因为你的数据量很小,扫描索引块的成本已高过全表扫表的成本
数据量大肯定会走索引的