读书人

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

发布时间: 2012-01-09 21:05:42 作者: rapoo

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表数据量特别大的时候)。

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

读书人网 >oracle

热点推荐