by drakula [기타] Partition Global Index [2010.05.25 21:03:13]
Global Partition Index 일 경우에는 Partition을 Add하거나, Split 하거나, Drop 하면은
무조건 UNUSABLE로 빠지는걸로 알고 있었는데,
테스트 해보니.ㅠ.ㅠ 그렇지 않네요~
제가 잘 못 알고 있었던것일까요?
create table scott.t ( gubun
, seq, seq_name, seq_cls
, seq2, seq2_name, seq2_cls
)
partition by range(seq) (
partition p1 values less than(100)
, partition p2 values less than(200)
, partition p3 values less than(300)
, partition p4 values less than(maxvalue)
)
as
select 1
, rownum, dbms_random.string('u', 10), 'A'
, round(dbms_random.value(1, 400)), dbms_random.string('l', 10), 'B'
from dual
connect by level <= 400 ;
create index scott.t_idx01 on scott.t(seq, seq_name) GLOBAL
partition by range(seq) (
partition p1 values less than(200)
, partition p2 values less than(maxvalue)
) ;
select index_name, status from dba_ind_partitions
where index_name = 'T_IDX01'
INDEX_NAME STATUS
-------------------
T_IDX01 USABLE
T_IDX01 USABLE
--Split 대상에 Index에 해당하는 Row가 있는 경우에는 UNUSABLE로 빠짐
alter table scott.t
split partition p4 at (400) into (partition p6, partition p4);
INDEX_NAME STATUS
-------------------
T_IDX01 UNUSABLE
T_IDX01 UNUSABLE
-- Index 다시 생성
DROP INDEX scott.t_idx01;
create index scott.t_idx01 on scott.t(seq, seq_name) GLOBAL
partition by range(seq) (
partition p1 values less than(200)
, partition p2 values less than(maxvalue)
) ;
-- Split 대상에 Index에 해당하는 Row가 없는 경우는 USABLE 상태
alter table scott.t
split partition p4 at (500) into (partition p6, partition p4);
select index_name, status from dba_ind_partitions
where index_name = 'T_IDX01';
INDEX_NAME STATUS
-------------------
T_IDX01 USABLE
T_IDX01 USABLE
--Max Value 삭제
alter table scott.t
drop partition p4;
select index_name, status from dba_ind_partitions
where index_name = 'T_IDX01';
INDEX_NAME STATUS
-------------------
T_IDX01 UNUSABLE
T_IDX01 UNUSABLE
-- 인덱스 다시 생성
DROP INDEX scott.t_idx01;
create index scott.t_idx01 on scott.t(seq, seq_name) GLOBAL
partition by range(seq) (
partition p1 values less than(200)
, partition p2 values less than(maxvalue)
) ;
-- Partition 추가
alter table scott.t
ADD partition p6 values less than (500) ;
select index_name, status from dba_ind_partitions
where index_name = 'T_IDX01';
select index_name, status from dba_ind_partitions
where index_name = 'T_IDX01';
INDEX_NAME STATUS
-------------------
T_IDX01 USABLE
T_IDX01 USABLE
내가 맺은 결론 :
Global Index도 Partition을 Add 하거나 Row에 해당하지 않는 Partition을 Split 해도 UNUSABLE로 빠지지 않는다...맞는 건가요??