> For the complete documentation index, see [llms.txt](https://docs.tibero.com/technical-guides/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tibero.com/technical-guides/topics/installation/physical-design/table-size.md).

# 테이블 크기 산정

Tibero DB 테이블 크기 산정 방법에 대해 설명합니다.

### Row의 데이터 길이 <a href="#id-2.1.1.-row" id="id-2.1.1.-row"></a>

테이블 크기를 산정하기 위해서는 컬럼의 데이터 타입별 실제 소비 크기와 저장되는 길이를 산정해야 합니다. \
이 정보는 테이블 크기를 산정하기 위한 항목별 크기 산정 방법에 사용됩니다.&#x20;

{% hint style="info" %}
데이터 타입별 크기는 “[데이터 타입별 크기 산정](/technical-guides/topics/installation/physical-design/data-type-size.md)”을 참고합니다.
{% endhint %}

아래는 컬럼 정의 및 계산 방식의 예입니다. \
크기 산정 테이블은 5개의 컬럼으로 구성되었다고 가정합니다.

| **이름**          | **데이터타입**     | **데이터길이** | **비고**                |
| --------------- | ------------- | --------- | --------------------- |
| c1              | CHAR(10)      | 10        |                       |
| c2              | DATE          | 8         |                       |
| c3              | NUMBER(7,2)   | 4         | roundup(7/2)          |
| c4              | CHAR(500)     | 500       |                       |
| c5              | VARCHAR(3000) | 2,100     | 3,000 \* 0,7          |
| **Row의 데이터 길이** |               | 2,622     | c1 + c2+ c3 + c4 + c5 |

"[데이터 타입별 크기 산정](/technical-guides/topics/installation/physical-design/data-type-size.md)"의 데이터 타입별 사이즈 표를 참고하여 위 테이블을 구성하는 각 컬럼의 데이터 타입별 실제 소비사이즈를 산정하면 아래와 같습니다.&#x20;

<table data-header-hidden><thead><tr><th width="134"></th><th></th></tr></thead><tbody><tr><td><strong>구분</strong></td><td><strong>설명</strong></td></tr><tr><td>CHAR</td><td>문자열의 길이는 byte와 문자를 기준으로 지정한다. <br>CHAR(10) = 10, CHAR(500) = 500</td></tr><tr><td>DATE</td><td>고정 8bytes 이다.</td></tr><tr><td>NUMBER</td><td>크기를 2로 나누어 반올림한 값이다. <br>NUMBER(7,2) = roundup(7/2) = 4</td></tr><tr><td>VARCHAR</td><td>지정된 길이의 70%로 가정한다. <br>VARCHAR(3000) = 3,000 * 0,7 = 2,100</td></tr></tbody></table>

### 항목별 크기 산정 <a href="#id-2.1.2" id="id-2.1.2"></a>

테이블 크기를 산정하기 위해 필요한 항목은 아래와 같습니다.

크기 예는 각 항목별로 기본으로 정해진 크기, 파라미터로 설정할 수 있는 크기와 운영할 시스템에서 사전 조사된 수치를 나타냅니다.&#x20;

<table data-header-hidden><thead><tr><th width="217"></th><th width="100"></th><th width="75"></th><th></th></tr></thead><tbody><tr><td><strong>항목</strong></td><td><strong>크기 예</strong></td><td><strong>단위</strong></td><td><strong>설명</strong></td></tr><tr><td>Row Directory</td><td>2</td><td>bytes</td><td>row 하나당 bytes</td></tr><tr><td>Row Header</td><td>3</td><td>bytes</td><td>row 하나당 bytes</td></tr><tr><td>250bytes 이하 컬럼개수</td><td>3</td><td>개수</td><td>위의 Row의 데이터 길이 테이블에 c1, c2, c3가 대상</td></tr><tr><td>250bytes 초과 컬럼개수</td><td>2</td><td>개수</td><td>위의 Row의 데이터 길이 테이블에 c4, c5가 대상</td></tr><tr><td>Block Size</td><td>8192</td><td>개수</td><td>기본값: 8192 (파라미터)</td></tr><tr><td>Block Header</td><td>48</td><td>bytes</td><td>고정 (Fixed Header)</td></tr><tr><td>INITRANS</td><td>2</td><td>개수</td><td>기본값: 2 (파라미터)</td></tr><tr><td>PCTFREE</td><td>10</td><td>%</td><td>기본값: 10% (파라미터)</td></tr><tr><td>ITL 공간</td><td>48</td><td>bytes</td><td>24 * 2 (24 * INITRANS)</td></tr><tr><td>초기 예상 건수</td><td>100,000</td><td>Rows</td><td>사용자 환경</td></tr><tr><td>월중 예상 추가 건수</td><td>20,000</td><td>Rows</td><td>사용자 환경</td></tr><tr><td>데이터 보관 월 수</td><td>120</td><td>개월</td><td>사용자 환경</td></tr></tbody></table>

250bytes 이하 및 초과 컬럼 개수는 Row의 데이터 길이 테이블을 참고합니다. 초기 예상 건수, 월중 예상 추가 건수, 데이터 보관 월 수는 운영할 시스템의 사용자 환경의 정보입니다.

###

***

## 테이블 크기 산정 방법 <a href="#bookmark6" id="bookmark6"></a>

본 절에서는 Tibero에서 테이블 크기를 산정하는 방법에 대해서 설명합니다.

### 한 Row 저장에 필요한 공간 <a href="#id-2.2.1.-row" id="id-2.2.1.-row"></a>

#### 산정 공식

```
한 Row 저장에 필요한 공간 = Row Directory + Row Header + Row의 데이터 길이
+ (1 * <250bytes 이하 컬럼개수>) + (3 * <250bytes 초과 컬럼개수>)
```

<table><thead><tr><th width="158">항목</th><th>사전 정보 크기</th><th>실제 저장 크기</th><th>비고</th></tr></thead><tbody><tr><td>Row Directory</td><td></td><td>2</td><td>2</td></tr><tr><td>Row Header</td><td>3</td><td>3</td><td></td></tr><tr><td>Row의 데이터 길이</td><td>2,622</td><td>2622</td><td></td></tr><tr><td>250bytes 이하 컬럼개수</td><td>3</td><td>1 * 3</td><td>1 * 250bytes 이하 컬럼개수</td></tr><tr><td>250bytes 초과 컬럼개수</td><td>2</td><td>3 * 2</td><td>3 * 250bytes 초과 컬럼개수</td></tr><tr><td><strong>Row Space</strong></td><td></td><td>2,636</td><td>2+3+2622+(1*3)+(3*2)</td></tr></tbody></table>

### 한 블록의 데이터 공간 <a href="#id-2.2.2" id="id-2.2.2"></a>

block당 사용 가능한 데이터 공간 크기입니다. <br>

#### 산정 공식

```
한 블록의 데이터 공간 = (Block Size - Block Header - ITL공간) * (100 - PCTFREE) / 100
```

<table data-header-hidden><thead><tr><th width="224"></th><th width="130"></th><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>항목</strong></td><td><strong>사전 정보 크기</strong></td><td><strong>실제 저장 크기</strong></td><td><strong>비고</strong></td></tr><tr><td>Block Size</td><td>8192</td><td>8192</td><td></td></tr><tr><td>Block Header</td><td>48</td><td>48</td><td></td></tr><tr><td>ITL공간</td><td>48</td><td>48</td><td>24 * 2 (24 * INITRANS)</td></tr><tr><td>PCTFREE</td><td>10</td><td>10</td><td></td></tr><tr><td><strong>Data Space per Block</strong></td><td></td><td>7,286</td><td>(8192-48-48)*(100-10)/100</td></tr></tbody></table>

### 한 블록에 들어갈 수 있는 Row 개수 <a href="#id-2.2.3.-row" id="id-2.2.3.-row"></a>

#### 산정 공식

```
/ Row Space ( 한 블록의 데이터 공간 / 한 Row의 저장에 필요한 공간 )
```

<table data-header-hidden><thead><tr><th width="210"></th><th width="143"></th><th width="170"></th><th></th></tr></thead><tbody><tr><td><strong>항목</strong></td><td><strong>사전 정보 크기</strong></td><td><strong>실제 저장 크기</strong></td><td><strong>비고</strong></td></tr><tr><td>Data Space per Block</td><td>7,286</td><td>7,286</td><td></td></tr><tr><td>Row Space</td><td>2,636</td><td>2,636</td><td></td></tr><tr><td><strong>Row Size per Block</strong></td><td></td><td>2</td><td>7,286 / 2,636</td></tr></tbody></table>

### 총 데이터 Row 개수 <a href="#id-2.2.4.-row" id="id-2.2.4.-row"></a>

#### 산정 공식

```
총 데이터 Row 개수 = <초기 예상 건수> + <월중 예상 추가 건수> * (<데이터 보관 월 수> + 1)
```

<table data-header-hidden><thead><tr><th></th><th width="132"></th><th width="140"></th><th></th></tr></thead><tbody><tr><td><strong>항목</strong></td><td><strong>사전 정보 크기</strong></td><td><strong>실제 저장 크기</strong></td><td><strong>비고</strong></td></tr><tr><td>초기 예상 건수</td><td>100,000</td><td>100,000</td><td></td></tr><tr><td>월중 예상 추가 건수</td><td>20,000</td><td>20,000</td><td></td></tr><tr><td>데이터 보관 월 수</td><td>120</td><td>120+1</td><td>&#x3C;데이터 보관 월 수> + 1</td></tr><tr><td><strong>Total Row Size</strong></td><td></td><td>2,520,000</td><td>100,000 +20,000 *(120+1)</td></tr></tbody></table>

### 필요한 총 데이터 공간 <a href="#id-2.2.5" id="id-2.2.5"></a>

#### 산정공식

```
필요한 총 데이터 공간 = Block Size * Total Row Size / Row Size per Block (Block Size
* 총 데이터 Row 개수 / 한 블록에 들어갈 수 있는 Row 개수)
```

<table data-header-hidden><thead><tr><th width="197"></th><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>항목</strong></td><td><strong>사전 정보 크기</strong></td><td><strong>실제 저장 크기</strong></td><td><strong>비고</strong></td></tr><tr><td>Block Size</td><td>8,192</td><td>8,192</td><td></td></tr><tr><td>Total Row Size</td><td>2,520,000</td><td>2,520,000</td><td></td></tr><tr><td>Row Size per Block</td><td>2</td><td>2</td><td></td></tr><tr><td><strong>Total Table Size</strong></td><td></td><td>10,321,920,000 (9.613037GB)</td><td>8,192 * 2,520,000 / 2</td></tr></tbody></table>

###
