Data Types in ClickHouse
ClickHouse can store various kinds of data in table cells. This section describes the supported data types and special considerations for using and/or implementing them if any.
Note
You can check whether a data type name is case-sensitive in the system.data_type_families table.
ClickHouse data types include:
- Integer types: signed and unsigned integers (
UInt8
,UInt16
,UInt32
,UInt64
,UInt128
,UInt256
,Int8
,Int16
,Int32
,Int64
,Int128
,Int256
) - Floating-point numbers: floats(
Float32
andFloat64
) andDecimal
values - Boolean: ClickHouse has a
Boolean
type - Strings:
String
andFixedString
- Dates: use
Date
andDate32
for days, andDateTime
andDateTime64
for instances in time - Object: the
Object
stores a JSON document in a single column (deprecated) - JSON: the
JSON
object stores a JSON document in a single column - UUID: a performant option for storing
UUID
values - Low cardinality types: use an
Enum
when you have a handful of unique values, or useLowCardinality
when you have up to 10,000 unique values of a column - Arrays: any column can be defined as an
Array
of values - Maps: use
Map
for storing key/value pairs - Aggregation function types: use
SimpleAggregateFunction
andAggregateFunction
for storing the intermediate status of aggregate function results - Nested data structures: A
Nested
data structure is like a table inside a cell - Tuples: A
Tuple
of elements, each having an individual type. - Nullable:
Nullable
allows you to store a value asNULL
when a value is "missing" (instead of the column settings its default value for the data type) - IP addresses: use
IPv4
andIPv6
to efficiently store IP addresses - Geo types: for geographical data, including
Point
,Ring
,Polygon
andMultiPolygon
- Special data types: including
Expression
,Set
,Nothing
andInterval