当前位置: 代码迷 >> Oracle开发 >> exists里面会走索引吗解决方案
  详细解决方案

exists里面会走索引吗解决方案

热度:142   发布时间:2016-04-24 08:00:56.0
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表数据量特别大的时候)。

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