Allows to store special marker (NULL) that denotes "missing value" alongside normal values allowed by
TypeName. For example, a
Nullable(Int8) type column can store
Int8 type values, and the rows that don't have a value will store
Nullable type field can't be included in table indexes.
NULL is the default value for any
Nullable type, unless specified otherwise in the ClickHouse server configuration.
Nullable type values in table column, ClickHouse uses a separate file with
NULL masks in addition to normal file with values. Entries in masks file allow ClickHouse to distinguish between
NULL and default value of corresponding data type for each table row. Because of additional file,
Nullable column consumes additional storage space compared to similar normal one.
Nullable almost always negatively affects performance, keep this in mind when designing your databases.
CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog
INSERT INTO t_null VALUES (1, NULL), (2, 3)
SELECT x + y FROM t_null
┌─plus(x, y)─┐ │ ᴺᵁᴸᴸ │ │ 5 │ └────────────┘