Airfold uses ClickHouse data types and table engines as its foundation. This page covers the most commonly used types and engines.

Data Types

Basic Types

TypeDescription
IntInteger numbers (Int8, Int16, Int32, Int64)
FloatFloating-point numbers (Float32, Float64)
DecimalFixed-point numbers with configurable precision
StringVariable-length strings
JSONSemi-structured JSON data with efficient storage

Date and Time

TypeDescription
DateDate values (YYYY-MM-DD)
DateTimeDate and time with timezone support
TimeTime values without date

Special Types

TypeDescription
EnumEnumerated values with named constants
UUIDUniversally unique identifier

Composite Types

TypeDescription
Array(T)Array of elements of type T
LowCardinality(T)Memory-optimized wrapper for low-cardinality data
Nullable(T)Allows NULL values for type T

Aggregate Function Types

TypeDescription
AggregateFunctionStores intermediate state of aggregate functions
SimpleAggregateFunctionSimplified version for basic aggregations

Key Concepts

PARTITION BY

Partitioning

  • Divides data into logical parts based on partition expression
  • Enables efficient data management and query performance
  • Common patterns: partition by date, month, or other logical groupings
  • Allows for efficient data pruning and deletion
CREATE TABLE events (
    event_date Date,
    user_id UInt64,
    event_type String
) ENGINE = MergeTree()
PARTITION BY toYYYYMM(event_date)
ORDER BY (event_date, user_id)

Benefits of Partitioning:

  • Faster queries when filtering by partition key
  • Efficient data lifecycle management
  • Parallel processing of partitions
  • Simplified data maintenance operations

Reference

For detailed documentation on data types and table engines, refer to the official ClickHouse documentation: