_대문 | 방명록 | 최근글 | 홈피소개 | 주인놈
FrontPage › TABLESIZE계산공식
Describe TABLESIZE계산공식 here

출처: http://devworld.co.kr

------------------------------------------------------
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)





댓글 남기기..
이름: : 오른쪽의 새로고침을 클릭해 주세요. 새로고침
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

사람은 누구나 자기에게 들리는 음악에 걸음을 맞춰야 한다. (H.D. 소로우)