
Unlock this content
Enter your email to unlock this content for free
Special Data Types
TL;DR
Arrays are generally safe. AggregateFunction types are essential for pre-aggregation. JSON, Enums, and Maps offer flexibility but can impact performance. Choose simple, structured types when possible for faster queries.
Arrays
Arrays are safe and efficient for storing lists of values. Combine with LowCardinality for categorical arrays.
CREATE TABLE events (
event_time DateTime,
user_id UInt32,
tags Array(LowCardinality(String)) -- Multiple tags per event
) ENGINE = MergeTree()
ORDER BY (event_time, user_id);