您的位置:首页 > 产品设计 > UI/UE

index unique scan vs index full scan

2009-09-20 20:52 357 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: