1. 확인
1-1. 최초 상태
SQL> select LF_ROWS,LF_BLKS,LF_ROWS_LEN,DEL_LF_ROWS,DEL_LF_ROWS_LEN from index_stats;
LF_ROWS LF_BLKS LF_ROWS_LEN DEL_LF_ROWS DEL_LF_ROWS_LEN
---------- ---------- ----------- ----------- ---------------
100000 199 1588892 0 0
1-2. 대량 데이터 삭제 후
SQL> select LF_ROWS,LF_BLKS,LF_ROWS_LEN,DEL_LF_ROWS,DEL_LF_ROWS_LEN from index_stats;
LF_ROWS LF_BLKS LF_ROWS_LEN DEL_LF_ROWS DEL_LF_ROWS_LEN
---------- ---------- ----------- ----------- ---------------
75797 199 1203168 9131 143916
SQL> SELECT (DEL_LF_ROWS_LEN/LF_ROWS_LEN)*100 from index_stats;
(DEL_LF_ROWS_LEN/LF_ROWS_LEN)*100
---------------------------------
11.9614218
1-3. Reorg 수행 후
SQL> select LF_ROWS,LF_BLKS,LF_ROWS_LEN,DEL_LF_ROWS,DEL_LF_ROWS_LEN fromindex_stats;
LF_ROWS LF_BLKS LF_ROWS_LEN DEL_LF_ROWS DEL_LF_ROWS_LEN
---------- ---------- ----------- ----------- ---------------
66666 148 1059252 0 0
SQL> select (del_lf_rows_len/lf_rows_len)*100 as index_usage from index_stats;
INDEX_USAGE
-----------
0
2. 기준
-
del_lf_rows_len/lf_rows_len >20%
-
대량 삭제가 발생했음을 의미함
3. 고려사항
-
정기적인 통계정보 갱신이 적용되는 경우에만 신뢰성 있는 리오그 대상식별이 가능함으로 이를 전제로 한다.
-
빈번한 입력/삭제 반복되는 테이블(예:인터페이스, tmp 데이터 저장..)인 경우 특별한 성능상의 저하현상이 발생하지 않을 경우 일반적인 리오그 수행여부 판단 기준이 적용되지 않는다.
-
갱신이 빈번하게 발생하는 테이블은 pctfree값을 크게 만들어 체이닝 발생을 최소화 한다.
4. 관련 스크립트
SELECT NUM_ROWS
,BLOCKS
,EMPTY_BLOCKS
,AVG_SPACE
,AVG_ROW_LEN
FROM DBA_TABLES
WHERE NUM_ROWS / BLCKS < 50;
SELECT a.owner
, a.table_name
, a.NUM_ROWS
, a.BLOCKS
, a.EMPTY_BLOCKS
, a.AVG_SPACE
, a.AVG_ROW_LEN
, b.bytes/1024/1024 bytes
FROM DBA_TABLES a
, dba_segments b
WHERE a.NUM_ROWS / a.BLOCKS < 50
and a.num_rows > 0
and a.blocks > 0
and a.owner = b.owner
and b.segment_type = 'TABLE'
and a.table_name = b.segment_name
and b.bytes/1024/1024 > 500
order by 1,2;
SELECT a.owner
, a.table_name
, a.NUM_ROWS
, a.BLOCKS
, a.EMPTY_BLOCKS
, a.AVG_SPACE
, a.AVG_ROW_LEN
, b.bytes/1024/1024 bytes
FROM DBA_TABLES a
, dba_segments b
WHERE a.empty_blocks > 7000
and a.num_rows > 0
and a.blocks > 0
and a.owner = b.owner
and b.segment_type = 'TABLE'
and a.table_name = b.segment_name
and b.bytes/1024/1024 > 300
order by 1,2;