Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

Native protocol column types

See Data Types for general reference.

Type Encoding
Integers (Int/UInt) 8, 16, 32, 64, 128 or 256 bits in little endian
Floats (Float32/Float64) IEEE 754 binary representation
String Array of strings as (len, value)
FixedString(N) Array of N-byte sequences
IPv4 Alias of UInt32, represented as UInt32
IPv6 Alias of FixedString(16), represented as binary
Tuple Array of columns encoded continuously. Example: Tuple(String, UInt8) = two continuous columns
Map Map(K, V) = three columns: Offsets ColUInt64, Keys K, Values V. Row count in Keys/Values = last Offsets value
Array Array(T) = two columns: Offsets ColUInt64, Data T. Row count in Data = last Offsets value
Nullable Nullable(T) = two columns: Nulls ColUInt8, Values T with same row count. Nulls is mask: 1=null, 0=value
UUID Alias of FixedString(16), represented as binary
Enum Alias of Int8 or Int16, each integer mapped to a String value
LowCardinality LowCardinality(T) = two columns: Index T, Keys K where K is UInt8/16/32/64. Index contains unique values, Keys contains indexes into Index
Bool Alias of UInt8: 0=false, 1=true

Example: Nullable encoding

To encode [null, "", "hello", null, "world"]:
  Values: ["", "", "hello", "", "world"] (len: 5)
  Nulls:  [ 1,  0,       0,  1,       0] (len: 5)

Example: LowCardinality encoding

To encode ["Eko", "Eko", "Amadela", "Amadela", "Amadela", "Amadela"]:
  Index: ["Eko", "Amadela"] (String)
  Keys:  [0, 0, 1, 1, 1, 1] (UInt8)
Navigation