- 最后登录
- 2014-10-16
- 在线时间
- 0 小时
- 威望
- 0
- 金钱
- 3
- 注册时间
- 2014-10-16
- 阅读权限
- 10
- 帖子
- 1
- 精华
- 0
- 积分
- 0
- UID
- 2080
|
6#
发表于 2014-10-16 17:06:01
非前缀索引的情况下,查询条件中包含分区键和索引列,但是执行集合中未对该分区索引进行裁剪。参考脚本如下:
-- 1. create table
create table t1 ( a int, b varchar2(300),c int) partition by range(a)
(
partition p01 values less than (1000),
partition p02 values less than (2000),
partition p03 values less than (3000),
partition p04 values less than (4000),
partition p05 values less than (5000),
partition p06 values less than (6000),
partition p07 values less than (7000),
partition p08 values less than (8000),
partition p09 values less than (9000),
partition p10 values less than (10000),
partition p11 values less than (11000),
partition p12 values less than (12000),
partition p13 values less than (13000),
partition p14 values less than (14000),
partition p15 values less than (15000),
partition p16 values less than (16000),
partition p17 values less than (17000),
partition p18 values less than (18000),
partition p19 values less than (19000),
partition p20 values less than (20000)
)
--2. populate testing data
insert into t1 select rownum,lpad('x',200,'x') from dual connect by rownum<20000;
commit
--copy
insert /*+ append */ into t1 select * from t1;
commit
insert /*+ append */ into t1 select * from t1;
commit
insert /*+ append */ into t1 select * from t1;
commit
insert /*+ append */ into t1 select * from t1;
commit
update t1 set c= MOD(a,7)*a;
commit
--3. create index
create index t1_idx on t1(c) local;
drop index t1_idx;
--create index t1_idxa_c on t1(a,c) local;
--drop index t1_idxa_c
--create index t1_idx_c_a on t1(c,a) local;
--drop index t1_idx_c_a
--4. query
select c from t1 where c >100 and c<1000 and a >=15000 and a<16000
select * from t1 where c >100 and c<1000 and a >=15000 and a<16000
欢迎指点。
|
|