index unique scan vs index full scan

来源:互联网 发布:mac os 10.8升级包 编辑:程序博客网 时间:2024/04/30 08:46

index unique scan ,是因为建了唯一索引, unique

如 :create unique index AA_INDEX on AA_TEST (SID, ITEMVALUE)

在执行语句中 where子句必须包括 唯一索引中的所有字段,而不用管select是否是索引中的字段.

analyze table aa_test compute statistics;

select sid,itemvalue from aa_test t where sid=1;

这个用 index range scan

select sid,itemvalue from aa_test t where itemvalue ='100';

这个用index full scan

也就是说如果在where子句中没有选择 唯一索引的前置索引字段,而是唯一索引的其他的字段,就会变成

index full scan

而对其他索引(不是唯一索引)中,只用索引中的某个字段(不是前置),只是 index range scan,不是index full scan,

从某些文档中知道 index full scan是index range scan的一个极限,当从index的叶子从左找到右时,就是index full scan.

下面是强制用 跳跃索引

select /*+ index_ss(aa_t inde_aa_t) */ aa_t.object_type
from aa_t where object_id =2

 

 

from :http://space.itpub.net/12712263/viewspace-606960

原创粉丝点击