Sizing for data types

Learn about how raw data size is determined for different data types.

String data types

Data type Raw size in bytes
CHAR(n) ASCII n for all values
CHAR(n) UTF8 If the value is NULL, the size is 1 byte. Otherwise, it is at least n bytes (each UTF-8 character may take up to 4 bytes).

VARCHAR(n)

If the value is NULL, the size is 1 byte. Otherwise, it is at least the actual number of characters in the string, regardless of the size of n (each UTF-8 character may take up to 4 bytes).

Decimal data type

The DECIMAL data type is specified as DECIMAL(p,s) where p is precision (total number of digits) and s is scale (number of fractional digits).

The raw size in bytes is determined by the precision value with the following ranges:

Precision (p) Raw size in bytes
1 – 2 1
3 – 4 2
5 – 6 3
7 – 9 4
10 – 11 5
12 – 14 6
15 – 16 7
17 – 18 8
19 – 36 16

Timestamp data types

The raw size of data using the TIMESTAMP data types depends on the fractional seconds precision (p), which is given as the number of decimals used to store fractional numbers. For example, 3 means millisecond precision (.001)

Fractional seconds precision (p)

Raw size in bytes

0 – 1

6

2 – 4

7

5 – 6

8

7 – 9

9

Exasol versions before 8.32.0 are limited to millisecond precision TIMESTAMP(3).

Geometry data type

The raw size of data using the GEOMETRY data type corresponds to the size in bytes that the binary representation of the geometry data requires.

Other data types

All other data types have a fixed raw size.

Data type Raw size in bytes
BOOLEAN 1
DATE 3
DOUBLE PRECISION 8
HASHTYPE(n BYTE) n + 1
INTERVAL DAY TO SECOND 8
INTERVAL YEAR TO MONTH 8