Server Settings

The maximum speed of data exchange over the network in bytes per second for replicated sends. Zero means unlimited.

## max\_replicated\_table\_num\_to\_throw[​](#max_replicated_table_num_to_throw "Direct link to max_replicated_table_num_to_throw")

If the number of replicated tables is greater than this value, the server will throw an exception.

Only counts tables for database engines:

- Atomic
- Ordinary
- Replicated
- Lazy

Note

A value of `0` means no limitation.

**Example**

```
<max_replicated_table_num_to_throw>400</max_replicated_table_num_to_throw>
```

## max\_server\_memory\_usage[​](#max_server_memory_usage "Direct link to max_server_memory_usage")

The maximum amount of memory the server is allowed to use, expressed in bytes.

Note

The maximum memory consumption of the server is further restricted by setting `max_server_memory_usage_to_ram_ratio`.

As a special case, a value of `0` (default) means the server may consume all available memory (excluding further restrictions imposed by `max_server_memory_usage_to_ram_ratio`).

## max\_server\_memory\_usage\_to\_ram\_ratio[​](#max_server_memory_usage_to_ram_ratio "Direct link to max_server_memory_usage_to_ram_ratio")

The maximum amount of memory the server is allowed to use, expressed as a ratio to all available memory.

For example, a value of `0.9` (default) means that the server may consume 90% of the available memory.

Allows lowering the memory usage on low-memory systems.
On hosts with low RAM and swap, you may possibly need setting [`max_server_memory_usage_to_ram_ratio`](#max_server_memory_usage_to_ram_ratio) set larger than 1.

Note

The maximum memory consumption of the server is further restricted by setting `max_server_memory_usage`.

## max\_session\_timeout[​](#max_session_timeout "Direct link to max_session_timeout")

Maximum session timeout, in seconds.

Example:

```
<max_session_timeout>3600</max_session_timeout>
```

## max\_snapshot\_commit\_thread\_pool\_free\_size[​](#max_snapshot_commit_thread_pool_free_size "Direct link to max_snapshot_commit_thread_pool_free_size")

If the number of idle threads in the snapshot commit thread pool exceeds `max_snapshot_commit_thread_pool_free_size`, ClickHouse will release resources occupied by idling threads and decrease the pool size. Threads can be created again if necessary.

## max\_snapshot\_commit\_thread\_pool\_size[​](#max_snapshot_commit_thread_pool_size "Direct link to max_snapshot_commit_thread_pool_size")

The number of threads to commit snapshot.

## max\_table\_num\_to\_throw[​](#max_table_num_to_throw "Direct link to max_table_num_to_throw")

If number of tables is greater than this value, server will throw an exception.

The following tables are not counted:

- view
- remote
- dictionary
- system

Only counts tables for database engines:

- Atomic
- Ordinary
- Replicated
- Lazy

Note

A value of `0` means no limitation.

**Example**

```
<max_table_num_to_throw>400</max_table_num_to_throw>
```

## max\_table\_num\_to\_warn[​](#max_table_num_to_warn "Direct link to max_table_num_to_warn")

If the number of attached tables exceeds the specified value, clickhouse server will add warning messages to `system.warnings` table.

**Example**

```
<max_table_num_to_warn>400</max_table_num_to_warn>
```

## max\_table\_size\_to\_drop[​](#max_table_size_to_drop "Direct link to max_table_size_to_drop")

Restriction on deleting tables.

If the size of a [MergeTree](/docs/engines/table-engines/mergetree-family/mergetree) table exceeds `max_table_size_to_drop` (in bytes), you can't delete it using a [`DROP`](/docs/sql-reference/statements/drop) query or [`TRUNCATE`](/docs/sql-reference/statements/truncate) query.

Note

A value of `0` means that you can delete all tables without any restrictions.

This setting does not require a restart of the ClickHouse server to apply. Another way to disable the restriction is to create the `<clickhouse-path>/flags/force_drop_table` file.

**Example**

```
<max_table_size_to_drop>0</max_table_size_to_drop>
```

## max\_temporary\_data\_on\_disk\_size[​](#max_temporary_data_on_disk_size "Direct link to max_temporary_data_on_disk_size")

The maximum amount of storage that could be used for external aggregation, joins or sorting.
Queries that exceed this limit will fail with an exception.

Note

A value of `0` means unlimited.

See also:

- [`max_temporary_data_on_disk_size_for_user`](/docs/operations/settings/settings#max_temporary_data_on_disk_size_for_user)
- [`max_temporary_data_on_disk_size_for_query`](/docs/operations/settings/settings#max_temporary_data_on_disk_size_for_query)

## max\_thread\_pool\_free\_size[​](#max_thread_pool_free_size "Direct link to max_thread_pool_free_size")

If the number of **idle** threads in the Global Thread pool is greater than [`max_thread_pool_free_size`](/docs/operations/server-configuration-parameters/settings#max_thread_pool_free_size), then ClickHouse releases resources occupied by some threads and the pool size is decreased. Threads can be created again if necessary.

**Example**

```
<max_thread_pool_free_size>1200</max_thread_pool_free_size>
```

## max\_thread\_pool\_size[​](#max_thread_pool_size "Direct link to max_thread_pool_size")

ClickHouse uses threads from the Global Thread pool to process queries. If there is no idle thread to process a query, then a new thread is created in the pool. `max_thread_pool_size` limits the maximum number of threads in the pool.

**Example**

```
<max_thread_pool_size>12000</max_thread_pool_size>
```

## max\_unexpected\_parts\_loading\_thread\_pool\_size[​](#max_unexpected_parts_loading_thread_pool_size "Direct link to max_unexpected_parts_loading_thread_pool_size")

The number of threads to load inactive set of data parts (Unexpected ones) at startup.

## max\_view\_num\_to\_throw[​](#max_view_num_to_throw "Direct link to max_view_num_to_throw")

If the number of views is greater than this value, the server will throw an exception.

Only counts tables for database engines:

- Atomic
- Ordinary
- Replicated
- Lazy

Note

A value of `0` means no limitation.

**Example**

```
<max_view_num_to_throw>400</max_view_num_to_throw>
```

## max\_view\_num\_to\_warn[​](#max_view_num_to_warn "Direct link to max_view_num_to_warn")

If the number of attached views exceeds the specified value, clickhouse server will add warning messages to `system.warnings` table.

**Example**

```
<max_view_num_to_warn>400</max_view_num_to_warn>
```

## max\_waiting\_queries[​](#max_waiting_queries "Direct link to max_waiting_queries")

Limit on total number of concurrently waiting queries.
Execution of a waiting query is blocked while required tables are loading asynchronously (see [`async_load_databases`](/docs/operations/server-configuration-parameters/settings#async_load_databases).

Note

Waiting queries are not counted when limits controlled by the following settings are checked:

- [`max_concurrent_queries`](/docs/operations/server-configuration-parameters/settings#max_concurrent_queries)
- [`max_concurrent_insert_queries`](/docs/operations/server-configuration-parameters/settings#max_concurrent_insert_queries)
- [`max_concurrent_select_queries`](/docs/operations/server-configuration-parameters/settings#max_concurrent_select_queries)
- [`max_concurrent_queries_for_user`](/docs/operations/settings/settings#max_concurrent_queries_for_user)
- [`max_concurrent_queries_for_all_users`](/docs/operations/settings/settings#max_concurrent_queries_for_all_users)

This correction is done to avoid hitting these limits just after server startup.

Note

A value of `0` (default) means unlimited.

This setting can be modified at runtime and will take effect immediately. Queries that are already running will remain unchanged.

## max\_zookeeper\_pooled\_connections[​](#max_zookeeper_pooled_connections "Direct link to max_zookeeper_pooled_connections")

Maximum number of lazily initialized ZooKeeper sessions per ZooKeeper cluster in the shared pool.

A value of `0` disables pooled connections and keeps using a single session.