
Unlock this content
Enter your email to unlock this content for free
Boolean
TL;DR
ClickHouse has a Bool type for boolean values. It's stored internally as UInt8 (1 byte per value), with true (1) and false (0). This is efficient and works well with columnar storage.
Using Bool Type
ClickHouse provides a Bool type for boolean values. It's stored internally as UInt8, but using Bool makes your schema more readable and semantically clear.
CREATE TABLE feature_flags (
flag_name LowCardinality(String),
is_enabled Bool DEFAULT false
) ENGINE = MergeTree()
ORDER BY flag_name;
-- Inserting boolean values