본문 바로가기

분류없는 게시글

오라클 테이블 사이즈 계산방법(수정 및 확인중)

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

TABLE SIZE 계산 공식(ORACLE BLOCK SIZE : 2K 로 가정)

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

$ sqlplus scott/tiger

SQL> SELECT GREATEST(4, ceil(ROW_COUNT /

((round(((1958 - (initrans * 23)) *

((100 - PCTFREE) /100)) / ADJ_ROW_SIZE)))) * BLOCK_SIZE)

TableSize_Kbytes

FROM dual;

*. 한 개의 BLOCK에 Available 한 Bytes - 1958

*. 각 initrans 는 23 Bytes

*. PCT_FREE : Table 의 pctfree 값(default 10)

*. ADJ_ROW_SIZE : 각 row 의 평균 SIZE 추정치

*. ROW_COUNT : table 의 row 의 갯수

*. BLOCK_SIZE : 1 block의 크기 (단위: K)

예) table 이름이 EMP 일 경우

ROW_COUNT : select count(*) from emp;

ADJ_ROW_SIZE : analyze table emp compute statistics;

(또는 건수가 매우 많을 때에는 compute 대신 estimate 사용)

select avg_row_len

from user_tables

where table_name='EMP';

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

INDEX SIZE 계산 공식

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

SQL> SELECT GREATEST(4, (1.01) * ((ROW_COUNT /

((floor(((2048 - 113 - (initrans * 23)) *

(1 - (PCTFREE/100))) /

((10 + uniqueness) + number_col_index +

(total_col_length)))))) * DB_BLOCK_SIZE))

IndexSize_Kbytes

FROM dual;

*. 한 개의 block에 available 한 bytes ( 1935 or 2048 - 113 )

*. 각 initrans 는 23 Bytes

*. ROW_COUNT : table 의 row 의 갯수

*. PCTFREE : Index 의 pctfree 값(default 10)

*. number_col_index : Index 에서 column 의 수

*. total_col_length : Index 의 길이 추정치

*. uniqueness : 만일 unique index 이면 1, non-unique index 이면 0.

*. DB_BLOCK_SIZE : 1 block의 크기 (단위: K)


'분류없는 게시글' 카테고리의 다른 글

강제로 복구 해야 할때  (0) 2011.08.07
오라클 힌트 옵션 정리  (0) 2011.07.05
Oracle Wait Event 모니터링  (0) 2011.06.22
DBMS의 심장 트랜젝션과 동시성 제어  (0) 2011.06.22
Partitioned Table  (0) 2011.06.22