| |
* Index Reorganization : index는 주기적으로 재 생성해줄 필요가 있다.
index를 analyze하여 usage를 측정해보자
SQL> analyze index dept_idx validate structure;
Index analyzed.
SQL> select (del_lf_rows_len/lf_rows_len)*100 as index_usage
2 from index_stats;
INDEX_USAGE
-----------
16.4948454 ==> delete된 leaf row length로 방금만든 index라 값이 정확치 않으나
10~20% 이상이 되면 index 재생성(rebuild) 필요하다.
* Index Rebuild
SQL> alter index dept_idx rebuild;
Index altered.
SQL> analyze index dept_idx validate structure;
Index analyzed.
SQL> select (del_lf_rows_len/lf_rows_len)*100 as index_usage
2 from index_stats;
INDEX_USAGE-----------
0 ==> rebuild하고 나서 0이 되었음을 알 수 있다.
- rebuild의 중요 option : 대상이 많으면 parallel, 빨리 rebuild 하게 하려면 nologging 을
쓸 수 있다.
- rebuild의 용도 : reorg
tablespace,storage절 수정
reverse index <--> normal index 로 switching
- rebuild중 query는 가능하고, 8i이상에서는 DML도 가능하다.
|