Data Type Sizes
System Design
A table of data type sizes in Postgres, useful for back-of-the-envelope calculations. The values will differ for different database systems, but the relative sizes will be similar. Squares are scaled in size logarithmically.
Type | Postgres Data Types | Size | Notes |
---|---|---|---|
Integer |
| 2 bytes 4 bytes 8 bytes | Used for numeric fields, IDs, and counters. Larger sizes support larger ranges. |
Floating Point |
| 4 bytes 8 bytes | Used for scientific calculations or approximate values. |
Timestamp |
| 8 bytes | Used for date and time fields, with or without timezone information. |
UUID |
| 16 bytes | Universally unique identifiers for distributed systems. |
Enum |
| 1 byte 4 bytes |
|
String |
| ~100 bytes ~1 KB ~10 KB |
|
JSONB |
| ~100 bytes ~1 KB ~10 KB |
|
BYTEA |
| ~1 KB ~100 KB ~1 MB |
|
Legend: 1 byte 100 bytes 1 KB (1,024 bytes) 10 KB 100 KB 1 MB (1,048,576 bytes) |