Sizing for Data Types

This section describes how the raw size is determined for different data types.

String Data Types

Data Type Raw Size in Bytes
CHAR(n) n
VARCHAR(n) The actual number of characters in the string, regardless of the size of n.

UTF-8 characters can use up to 4 bytes per character. The raw size for VARCHAR and CHAR strings in UTF-8 format will be calculated as the number of characters in the string multiplied with a maximum of 4 bytes per character.

Geometry

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

Decimal

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

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
TIMESTAMP 7
TIMESTAMP WITH LOCAL TIME ZONE 7