# 데이터 타입별 크기 산정

아래 표는 테이블과 인덱스 크기 시트의 계산식에서 적용되는 데이터 타입별 실제 소비 사이즈이며 저장 되는 크기는 산정 길이 +1로 합니다. 예를 들면 데이터의 산정 길이는 8bytes이며 실제 저장 데이터는 8+1=9bytes입니다.

## 데이터 타입별 크기 산정 방법

* **문자형**

<table data-header-hidden><thead><tr><th width="141"></th><th width="73"></th><th width="199"></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>CHAR</td><td>고정/ 가변</td><td>CHAR(10) = 10bytes</td><td><ul><li>CHAR(10 BYTE), CHAR(10 CHAR) 문자열의 길이는 byte와 문자를 기준으로 지정한다.</li><li>CHAR(10)의 형태로 선언하면, byte로 문자 열의 길이가 지정된다.</li><li>CHAR로 길이를 선언하면 문자가 몇 byte로 표현되는지에 따라 그 길이가 달라진다.</li></ul></td></tr><tr><td>VARCHAR</td><td>가변</td><td><p>VARCHAR 가변 VARCHAR(10) =</p><p>(10*0,7)= 7bytes</p></td><td>지정된 데이터 길이의 0.7로 가정</td></tr><tr><td>NCHAR</td><td>고정</td><td><p>NCHAR(10) = 30bytes(UTF8),</p><p>20bytes(UTF16 )</p></td><td><ul><li>UTF8 : size의 최대 3배</li><li>UTF16 : size의 최대 2배</li></ul></td></tr><tr><td>NVARCHAR</td><td>가변</td><td><p>NVARCHAR(10) = (10*0.7)*3 =</p><p>21bytes(UTF8), 14bytes(UTF16)</p></td><td><ul><li>UTF8 : size의 최대 3배</li><li>UTF16 : size의 최대 2배</li></ul></td></tr><tr><td>RAW</td><td>가변</td><td></td><td>실제로 저장되는 데이터의 길이</td></tr><tr><td>LONG</td><td>가변</td><td></td><td>실제로 저장되는 데이터의 길이</td></tr><tr><td>LONG RAW</td><td>가변</td><td></td><td>실제로 저장되는 데이터의 길이</td></tr></tbody></table>

* **숫자형**

<table data-header-hidden><thead><tr><th width="139"></th><th width="82"></th><th width="211"></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>NUMBER</td><td>가변</td><td><p>NUMBER(7)</p><p>=roundup(7/2) = 4bytes</p></td><td>roundup(size/2) size가 38 자리수보다 크면 38 로 정 의하고 38 자리수 미만의 음수는 1byte를 더한다.</td></tr><tr><td>INTEGER</td><td>가변</td><td></td><td>NUMBER와 같다.</td></tr><tr><td>FLOAT</td><td>가변</td><td></td><td>NUMBER와 같다.</td></tr></tbody></table>

* **날짜형**

<table data-header-hidden><thead><tr><th width="338"></th><th width="117"></th><th></th></tr></thead><tbody><tr><td><strong>타입</strong></td><td><strong>고정/가변</strong></td><td><strong>길이 산정 예</strong></td></tr><tr><td>DATE</td><td>고정</td><td>8bytes</td></tr><tr><td>TIME</td><td>고정</td><td>8bytes</td></tr><tr><td>TIMESTAMP</td><td>가변</td><td>12bytes</td></tr><tr><td>TIMESTAMP WITH TIME ZONE</td><td>고정 1</td><td>7bytes</td></tr><tr><td>TIMESTAMP WITH LOCAL TIME ZONE</td><td>고정</td><td>12bytes</td></tr></tbody></table>

* **간격형**

<table data-header-hidden><thead><tr><th width="340"></th><th width="119"></th><th></th></tr></thead><tbody><tr><td><strong>타입</strong></td><td><strong>고정/가변</strong></td><td><strong>길이 산정 예</strong></td></tr><tr><td>INTERVAL YEAR TO MONTH</td><td>고정</td><td>5bytes</td></tr><tr><td>INTERVAL DAY TO SECOND</td><td>고정</td><td>12bytes</td></tr></tbody></table>

* **대용량 객체형**

<table data-header-hidden><thead><tr><th width="139"></th><th width="106"></th><th width="134"></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>CLOB</td><td>가변</td><td></td><td>실제로 저장되는 데이터의 길이 <br>("<a href="#id-4.1.-lob-type-overhead">LOB Type 저장에 필요한 overhead</a>" 참조)</td></tr><tr><td>BLOB</td><td>가변</td><td></td><td>실제로 저장되는 데이터의 길이 <br>("<a href="#id-4.1.-lob-type-overhead">LOB Type 저장에 필요한 overhead</a>" 참조)</td></tr><tr><td>XMLTYPE</td><td>가변</td><td></td><td>CLOB과 같다.</td></tr></tbody></table>

* **내재형**

| **타입** | **고정/가변** | **길이 산정 예** | **설명** |
| ------ | --------- | ----------- | ------ |
| ROWID  | 고정        | 10bytes     |        |

###

***

## LOB Type 저장에 필요한 overhead <a href="#id-4.1.-lob-type-overhead" id="id-4.1.-lob-type-overhead"></a>

* **NULL일 때**

```
0byte
```

* **크기가 0일 때**

```
16bytes(lob locator)
```

* **크기가 4000보다 작을 때**

```
16bytes(lob locator) + 16bytes(lob inode)
```

* **크기가 96KB 보다 작을 때**

```
16bytes(lob locator) + 16bytes(lob inode) + 48bytes(12 page dbas)
```

* **그 이상일 때**

```
16bytes(lob locator) + 16bytes(lob inode) + 48bytes * (LOB 컬럼 크기 / 64KB)(lob index)
```

위 계산에서 LOB 데이터를 별도 segment로 저장하기 위한 overhead는 계산하지 않습니다.

long의 경우 데이터의 길이가 길어지면 chained row piece로 나뉘어서 저장되는데, row piece를 연결시키기 위한 추가 overhead는 고려하지 않습니다.&#x20;

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tibero.com/technical-guides/topics/installation/physical-design/data-type-size.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
