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) 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 four 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 four bytes). |
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 |