Introduction
Materialize supports a comprehensive set of SQL data types for storing and manipulating data. The type system is PostgreSQL-compatible and includes both built-in types and support for custom types.Built-in Types
Numeric Types
Integer Types
Small signed integer (2 bytes). Range: -32,768 to 32,767.
Standard signed integer (4 bytes). Range: -2,147,483,648 to 2,147,483,647.
Large signed integer (8 bytes). Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
Unsigned Integer Types
uint2
Small unsigned integer (2 bytes). Range: 0 to 65,535.
uint4
Unsigned integer (4 bytes). Range: 0 to 4,294,967,295.
uint8
Large unsigned integer (8 bytes). Range: 0 to 18,446,744,073,709,551,615.
Floating-Point Types
Single precision floating-point (4 bytes). Precision: 6 decimal digits.
Double precision floating-point (8 bytes). Precision: 15 decimal digits.
Exact Numeric Type
Exact numeric with user-defined precision and scale (16 bytes). Supports arbitrary precision.
Text Types
Variable-length Unicode string. No length limit.
Variable-length string with optional length limit.
Fixed-length string, blank-padded.
Binary Type
bytea
Variable-length binary string. Used for storing raw bytes.
Boolean Type
Logical boolean value:
TRUE or FALSE.Date/Time Types
date
Calendar date (year, month, day) without time. 4 bytes.
time
Time of day (no date, no timezone). 4 bytes.
timestamp
Date and time without timezone. 8 bytes.
Date and time with timezone. 8 bytes.
interval
Time span or duration. 32 bytes.
JSON Type
Binary JSON data. Supports indexing and querying JSON documents.
UUID Type
uuid
Universally Unique Identifier. 16 bytes.
OID Type
oid
PostgreSQL object identifier. 4 bytes. Used internally for system catalogs.
Collection Types
Arrays
array
Multidimensional array of any data type.
Lists
list
Variable-length multidimensional list. Similar to arrays but with different semantics.
Maps
map
Key-value map with text keys and uniform value type.
Records
record
Tuple with arbitrary contents. Useful for composite types.
Custom Types
You can create custom types usingCREATE TYPE:
Type Casting
Materialize supports explicit and implicit type casting:Type Compatibility
When working with different types:- Numeric types can generally be cast between each other
- Text types are interchangeable
- Date/time types can be cast between compatible types
- Arrays, lists, and maps require compatible element types
- Custom types can be cast to their underlying built-in types
NULL Values
All types can be nullable unless explicitly marked asNOT NULL:
Type Sizing
Some types have fixed sizes, while others are variable:| Type Category | Storage |
|---|---|
smallint | 2 bytes |
integer | 4 bytes |
bigint | 8 bytes |
real | 4 bytes |
double precision | 8 bytes |
numeric | 16 bytes |
text | Variable |
bytea | Variable |
date | 4 bytes |
timestamp | 8 bytes |
uuid | 16 bytes |
jsonb | Variable |