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(Float32andFloat64) andDecimalvalues
- Boolean: ClickHouse has a Booleantype
- Strings: StringandFixedString
- Dates: use DateandDate32for days, andDateTimeandDateTime64for instances in time
- Object: the Objectstores a JSON document in a single column (deprecated)
- JSON: the JSONobject stores a JSON document in a single column
- UUID: a performant option for storing UUIDvalues
- Low cardinality types: use an Enumwhen you have a handful of unique values, or useLowCardinalitywhen you have up to 10,000 unique values of a column
- Arrays: any column can be defined as an Arrayof values
- Maps: use Mapfor storing key/value pairs
- Aggregation function types: use SimpleAggregateFunctionandAggregateFunctionfor storing the intermediate status of aggregate function results
- Nested data structures: A Nesteddata structure is like a table inside a cell
- Tuples: A Tupleof elements, each having an individual type.
- Nullable: Nullableallows you to store a value asNULLwhen a value is "missing" (instead of the column settings its default value for the data type)
- IP addresses: use IPv4andIPv6to efficiently store IP addresses
- Geo types: for geographical data, including Point,Ring,PolygonandMultiPolygon
- Special data types: including Expression,Set,NothingandInterval