---
title: "Durability"
description: "When ClickHouse acknowledges an insert, and the settings that make it wait for more replicas."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Durability

A warehouse's durability is ClickHouse's own, and you choose it per session or per query.

## Inserts into a replicated table

By default (`insert_quorum = 0`) an insert is acknowledged once one replica of the shard has written
it; the shard's other replicas then fetch it.

To wait until more replicas have it, set `insert_quorum`:

```sql
INSERT INTO events.page_views SETTINGS insert_quorum = 2 VALUES (now(), 42, '/');
```

| Replicas | `insert_quorum = 2` |
| --- | --- |
| 2 | Each insert waits for both replicas, and fails while one of them is down. |
| 3 | Each insert waits for two of the three, and keeps working while one is down. |

`insert_quorum_timeout` sets how long an insert waits.

## Inserts through a Distributed table

By default an insert into a `Distributed` table is acknowledged once the node you're connected to has
queued it; that node then sends each row to its shard. With `insert_distributed_sync = 1` (also named
`distributed_foreground_insert`), the insert
waits until every shard has written its rows, and with `insert_quorum` set, until the quorum has.

```sql
INSERT INTO events.page_views_all SETTINGS insert_distributed_sync = 1, insert_quorum = 2
VALUES (now(), 42, '/');
```

## For a session or a query

A user can `SET` these for its session, or a client can send them with each query (on HTTPS, as URL
parameters such as `?insert_quorum=2`).

Source: https://docs.ezghcloud.com/warehouse/durability/index.mdx
