Unlock this content

Enter your email to unlock this content for free

By continuing, you agree to our Terms of Service and Privacy Notice, and to receive occasional marketing emails.

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

Tinybird is not affiliated with, associated with, or sponsored by ClickHouse, Inc. ClickHouse® is a registered trademark of ClickHouse, Inc.

Boolean | ClickHouse for Developers