oracle skipscan,查询条件包含组合索引所有键为啥执行计划走的是index skip scan???...

请参考!这个没有什么原因能解释,只能说是oracle一个bug!

参照CBO一书原文如下!

create index t1_i1 on t1(n1, ind_pad, n2)

More on Range-based Tests

We took the easy option, and did a range-based test on the last column in the index. What

happens if we do a range-based test on an earlier column in the index? Try this, for example:

alter session set "_optimizer_skip_scan_enabled"=false;

select

/*+ index(t1) */

small_vc

from

t1

where

n1 between 1 and 3

and ind_pad = rpad('x',40)

and n2 = 2

;

Execution Plan (8.1.7.4)

----------------------------------------------------------

0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=264 Card=82 Bytes=4756)

1 0 TABLE ACCESS (BY INDEX ROWID) OF 'T1' (Cost=264 Card=82 Bytes=4756)

2 1 INDEX (RANGE SCAN) OF 'T1_I1' (NON-UNIQUE) (Cost=184 Card=82)

Execution Plan (9.2.0.6 and 10.1.0.4)

----------------------------------------------------------

0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=264 Card=82 Bytes=4756)

1 0 TABLE ACCESS (BY INDEX ROWID) OF 'T1' (Cost=264 Card=82 Bytes=4756)

2 1 INDEX (RANGE SCAN) OF 'T1_I1' (NON-UNIQUE) (Cost=184 Card=1633)

The alter session command is there for the benefit of 9i and 10g. The unhinted execution

plan was a full tablescan, but when I first put in an index hint, the optimizer insisted on using

the index skip scan mechanism, and in 10g if I then included the no_index_ss() hint, the index

was disabled and the plan went back to a tablescan (I would be inclined to call this behavior a

bug—it seems perfectly reasonable to me to say, “Use this index, but don’t do a skip scan,” but

it is possible that it’s the specified behavior).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值