熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

跳躍式索引

2013-11-13 22:12:58  來源: Oracle 

  從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


From:http://tw.wingwit.com/Article/program/Oracle/201311/18500.html
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.