Home | Print | Q/A | Guest | NewsLetter
Display context of search results Case-sensitive searching
Database System
Data Warehouse
Data Analysis
Operating System
Open Source
Enterprise Architecture
Software Engineering
Process
Working Smart

SQL Server
PostgreSQL
Oracle
DB2
Teradata
MySQL
Performance Tuning
Programming

Link
Philosophy
Tools
Misc
주인놈
_
_
SideBar Edit
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|FindPage|DeletePage|LikePages|http://www.databaser.net|last modified 2010-03-08 17:39:58