从Oraclei开始索引跳跃式扫描特性可以允许优化器使用组合索引即便索引的前导列没有出现在WHERE子句中索引跳跃式扫描比全索引扫描要快的多下面的程序清单显示出性能的差别 create index idx_skip on emp(jobempno); index created select count(*) from emp where empno=; Elapsed::: Execution Plan SELECT STATEMENT Optimizer=CHOOSE(Cost= Card= Bytes=) SORT(AGGREGATE) INDEX(FAST FULL SCAN) OF idx_skip(NONUNIQUE) Statistics consistent gets physical reads select /*+ index(emp idx_skip)*/ count(*) from emp where empno=; Elapsed::: Execution Plan SELECT STATEMENT Optimizer=CHOOSE(Cost= Card= Bytes=) SORT(AGGREGATE) INDEX(SKIP SCAN) OF idx_skip (NONUNIQUE) Statistics consistent gets physical reads |