ClickHouse Data Types: Complete Guide

In ClickHouse, data types are mainly categorized into the following groups:

  1. Numeric data type:
  1. Int8, Int16, Int32, Int64: Signed integer types used to store 8-bit, 16-bit, 32-bit, and 64-bit integers, respectively.
  2. UInt8, UInt16, UInt32, UInt64: Unsigned integer types used to store 8-bit, 16-bit, 32-bit, and 64-bit unsigned integers, respectively.
  3. Float32 and Float64: data types used to store 32-bit and 64-bit floating point numbers, respectively.
  1. String data type:
  1. String: variable-length string type.
  2. FixedString(N) is a type of string with a set length of N characters.
  1. Date and time formats:
  1. Date is a data type that stores the year, month, and day.
  2. DateTime is a data type that stores the year, month, day, hour, minute, and second.
  1. Boolean type:
  1. Boolean is a data type used to store true or false values.
  1. Enumeration type:
  1. Enum8 and Enum16: Enumerated types used to store values within a specific range of enumerated values.
  1. Other categories:
  1. UUID: A data type used to store universal unique identifiers.
  2. Array(T):Array type used to store an array of elements of type T.
  3. Tuple(T1, T2, …): a type of data structure used for storing multiple values of different types.

The above are commonly used data types in ClickHouse. The choice of different data types depends on the characteristics of the data and the application scenario.

bannerAds