> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-3a82795f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Documentation for the Nullable data type modifier in ClickHouse

# Nullable(T)

Allows to store special marker ([NULL](/reference/syntax)) that denotes "missing value" alongside normal values allowed by `T`. For example, a `Nullable(Int8)` type column can store `Int8` type values, and the rows that do not have a value will store `NULL`.

`T` can't be any of the following composite data types:

* [Array](/reference/data-types/array) — Not supported
* [Map](/reference/data-types/map) — Not supported
* [Tuple](/reference/data-types/tuple) — Experimental support available\*

However, composite data types **can contain** `Nullable` type values, e.g. `Array(Nullable(Int8))` or `Tuple(Nullable(String), Nullable(Int64))`.

<Info>
  **Experimental: Nullable Tuples**

  * [Nullable(Tuple(...))](/reference/data-types/tuple#nullable-tuple) is supported when `allow_experimental_nullable_tuple_type = 1` is enabled.
</Info>

A `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.

<h2 id="storage-features">
  Storage Features
</h2>

To store `Nullable` type values in a 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 a default value of corresponding data type for each table row. Because of an additional file, `Nullable` column consumes additional storage space compared to a similar normal one.

<Note>
  Using `Nullable` almost always negatively affects performance, keep this in mind when designing your databases.
</Note>

<h2 id="finding-null">
  Finding NULL
</h2>

It is possible to find `NULL` values in a column by using `null` subcolumn without reading the whole column. It returns `1` if the corresponding value is `NULL` and `0` otherwise.

**Example**

```sql title="Query" theme={null}
CREATE TABLE nullable (`n` Nullable(UInt32)) ENGINE = MergeTree ORDER BY tuple();

INSERT INTO nullable VALUES (1) (NULL) (2) (NULL);

SELECT n.null FROM nullable;
```

```text title="Response" theme={null}
┌─n.null─┐
│      0 │
│      1 │
│      0 │
│      1 │
└────────┘
```

<h2 id="usage-example">
  Usage Example
</h2>

```sql theme={null}
CREATE TABLE t_null(x Int8, y Nullable(Int8)) ENGINE TinyLog
```

```sql theme={null}
INSERT INTO t_null VALUES (1, NULL), (2, 3)
```

```sql theme={null}
SELECT x + y FROM t_null
```

```text theme={null}
┌─plus(x, y)─┐
│       ᴺᵁᴸᴸ │
│          5 │
└────────────┘
```
