Numeric Types
Integer Types
Fixed-length integers with or without a sign.Signed Integers
int8— Range: [-128 : 127]int16— Range: [-32768 : 32767]int32— Range: [-2147483648 : 2147483647]int64— Range: [-9223372036854775808 : 9223372036854775807]int128— Range: [-170141183460469231731687303715884105728 : 170141183460469231731687303715884105727]int256— Range: [-57896044618658097711785492504343953926634992332820282019728792003956564819968 : 57896044618658097711785492504343953926634992332820282019728792003956564819967]
int8—TINYINT,BOOL,BOOLEAN,INT1int16—SMALLINT,INT2int32—INT,INT4,INTEGERint64—BIGINT
Unsigned Integers
uint8— Range: [0 : 255]uint16— Range: [0 : 65535]uint32— Range: [0 : 4294967295]uint64— Range: [0 : 18446744073709551615]uint128— Range: [0 : 340282366920938463463374607431768211455]uint256— Range: [0 : 115792089237316195423570985008687907853269984665640564039457584007913129639935]
Floating Point Types
float32— 32-bit floating point number (IEEE 754 single precision)float64— 64-bit floating point number (IEEE 754 double precision)
float32—FLOAT,REAL,SINGLEfloat64—DOUBLE,DOUBLE PRECISION
Decimal Types
Fixed-precision decimal numbers. Syntax:decimal(P, S) where P is precision (total digits) and S is scale (decimal places).
decimal32(S)— Precision up to 9 digitsdecimal64(S)— Precision up to 18 digitsdecimal128(S)— Precision up to 38 digitsdecimal256(S)— Precision up to 76 digits
String Types
String
Variable-length strings with no size limit. Can contain arbitrary bytes including null bytes. Aliases:LONGTEXT, MEDIUMTEXT, TINYTEXT, TEXT, LONGBLOB, MEDIUMBLOB, TINYBLOB, BLOB, VARCHAR, CHAR
Example:
Fixed String
Fixed-length strings. Syntax:fixed_string(N) where N is the string length in bytes.
- Strings shorter than N are padded with null bytes
- Strings longer than N cause an error
- Maximum size: 0xFFFFFF (16,777,215 bytes)
Date and Time Types
Date
Stores calendar dates (year, month, day).- Storage: 2 bytes (as uint16)
- Range: [1970-01-01 : 2149-06-06]
- Resolution: 1 day
- Format: YYYY-MM-DD
Date32
Extended date type with wider range.- Storage: 4 bytes (as int32)
- Range: [1900-01-01 : 2299-12-31]
- Resolution: 1 day
- Format: YYYY-MM-DD
DateTime
Stores timestamp as Unix time (seconds since epoch). Syntax:datetime([timezone])
- Storage: 4 bytes (as uint32)
- Range: [1970-01-01 00:00:00 : 2105-12-31 23:59:59]
- Resolution: 1 second
- Format: YYYY-MM-DD hh:mm:ss
- Timezone only affects text format parsing and display
- Internal storage is always Unix timestamp (UTC)
- Timezone conversion has no computation cost (metadata only)
DateTime64
High-precision timestamp with sub-second resolution. Syntax:datetime64(precision, [timezone])
- Storage: 8 bytes (as int64)
- Precision: 0-9 decimal places (default: 3 for milliseconds)
- Format: YYYY-MM-DD hh:mm:ss.sss
Complex Types
Array
Dynamic array of elements of the same type. Syntax:array(T) where T is any data type
- Maximum size: 1 million elements
- Supports nested arrays
- Elements must be of the same type
Tuple
Ordered collection of elements with individual types. Syntax:tuple(T1, T2, ...) or tuple(name1 T1, name2 T2, ...)
- Elements can have different types
- Can be named or unnamed
- Used for temporary column grouping
Map
Key-value pair storage. Syntax:map(K, V) where K is the key type and V is the value type
- Keys can be any type except nullable or low cardinality nullable
- Values can be any type
- Maps can contain duplicate keys (internally
array(tuple(K, V))) - Non-unique keys allowed
JSON
The
JSON object type is deprecated in Timeplus Proton. For working with JSON data, use one of these approaches:- Store as
stringtype and use JSON functions for parsing - Use
map(string, string)for simple key-value JSON - Parse into strongly-typed columns using JSON functions
Nullable Types
Wraps any base type to allow NULL values. Syntax:nullable(T) where T is any data type
- Adds special NULL marker alongside normal values
- Cannot be used in table indexes
- Adds storage overhead (separate NULL mask file)
- Performance impact: almost always negative
- Default value for nullable type is NULL
- Cannot wrap
arrayortupledirectly - Can wrap elements:
array(nullable(int32))is valid nullable(array(int32))is invalid
Type Conversion
Implicit Conversion
Timeplus Proton automatically converts between compatible types in many situations. Example:Explicit Conversion
UseCAST or conversion functions for explicit type conversion.
CAST Syntax:
Decimal Conversions
ClickHouse Compatibility
Timeplus Proton maintains compatibility with ClickHouse data types:Fully Compatible Types
- All integer types (
int8throughint256,uint8throughuint256) - Floating point types (
float32,float64) - Decimal types (
decimal32,decimal64,decimal128,decimal256) - String types (
string,fixed_string) - Date types (
date,date32,datetime,datetime64) - Complex types (
array,tuple,map) nullablewrapper type
Type Aliases
Most ClickHouse type aliases are supported for compatibility:- SQL standard names:
INT,BIGINT,VARCHAR,DOUBLE, etc. - MySQL-style names:
TINYINT,TEXT,BLOB, etc.
Best Practices
- Choose appropriate precision: Use the smallest integer type that fits your data range
- Avoid nullable when possible: Nullable types have performance overhead
- Use appropriate string types: Use
fixed_stringfor fixed-width codes,stringfor variable content - Consider timezone handling: Always specify timezone for datetime types when dealing with multi-region data
- Array size limits: Keep arrays under 1 million elements
- Decimal vs Float: Use
decimalfor financial data,floatfor scientific measurements