MergeTree tables settings

## max\_part\_loading\_threads[​](#max_part_loading_threads "Direct link to max_part_loading_threads")

Obsolete setting, does nothing.

## max\_part\_removal\_threads[​](#max_part_removal_threads "Direct link to max_part_removal_threads")

Obsolete setting, does nothing.

## max\_partitions\_to\_read[​](#max_partitions_to_read "Direct link to max_partitions_to_read")

Limits the maximum number of partitions that can be accessed in one query.

The setting value specified when the table is created can be overridden via
query-level setting.

Possible values:

- Any positive integer.

You can also specify a query complexity setting [max\_partitions\_to\_read](/docs/operations/settings/settings#max_partitions_to_read)
at a query / session / profile level.

## max\_parts\_in\_total[​](#max_parts_in_total "Direct link to max_parts_in_total")

If the total number of active parts in all partitions of a table exceeds the
`max_parts_in_total` value `INSERT` is interrupted with the `Too many parts (N)` exception.

Possible values:

- Any positive integer.

A large number of parts in a table reduces performance of ClickHouse queries
and increases ClickHouse boot time. Most often this is a consequence of an
incorrect design (mistakes when choosing a partitioning strategy - too small
partitions).

## max\_parts\_to\_merge\_at\_once[​](#max_parts_to_merge_at_once "Direct link to max_parts_to_merge_at_once")

Max amount of parts which can be merged at once (0 - disabled). Doesn't affect
OPTIMIZE FINAL query.

## max\_postpone\_time\_for\_failed\_mutations\_ms[​](#max_postpone_time_for_failed_mutations_ms "Direct link to max_postpone_time_for_failed_mutations_ms")

The maximum postpone time for failed mutations.

## max\_postpone\_time\_for\_failed\_replicated\_fetches\_ms[​](#max_postpone_time_for_failed_replicated_fetches_ms "Direct link to max_postpone_time_for_failed_replicated_fetches_ms")

The maximum postpone time for failed replicated fetches.

## max\_postpone\_time\_for\_failed\_replicated\_merges\_ms[​](#max_postpone_time_for_failed_replicated_merges_ms "Direct link to max_postpone_time_for_failed_replicated_merges_ms")

The maximum postpone time for failed replicated merges.

## max\_postpone\_time\_for\_failed\_replicated\_tasks\_ms[​](#max_postpone_time_for_failed_replicated_tasks_ms "Direct link to max_postpone_time_for_failed_replicated_tasks_ms")

The maximum postpone time for failed replicated task. The value is used if the task is not a fetch, merge or mutation.

## max\_projections[​](#max_projections "Direct link to max_projections")

The maximum number of merge tree projections.

## max\_replicated\_fetches\_network\_bandwidth[​](#max_replicated_fetches_network_bandwidth "Direct link to max_replicated_fetches_network_bandwidth")

Limits the maximum speed of data exchange over the network in bytes per
second for [replicated](/docs/engines/table-engines/mergetree-family/replication)
fetches. This setting is applied to a particular table, unlike the
[`max_replicated_fetches_network_bandwidth_for_server`](/docs/operations/settings/merge-tree-settings#max_replicated_fetches_network_bandwidth)
setting, which is applied to the server.

You can limit both server network and network for a particular table, but for
this the value of the table-level setting should be less than server-level
one. Otherwise the server considers only the
`max_replicated_fetches_network_bandwidth_for_server` setting.

The setting isn't followed perfectly accurately.

Possible values:

- Positive integer.
- `0` — Unlimited.

Default value: `0`.

**Usage**

Could be used for throttling speed when replicating data to add or replace
new nodes.

## max\_replicated\_logs\_to\_keep[​](#max_replicated_logs_to_keep "Direct link to max_replicated_logs_to_keep")

How many records may be in the ClickHouse Keeper log if there is inactive
replica. An inactive replica becomes lost when when this number exceed.

Possible values:

- Any positive integer.

## max\_replicated\_merges\_in\_queue[​](#max_replicated_merges_in_queue "Direct link to max_replicated_merges_in_queue")

How many tasks of merging and mutating parts are allowed simultaneously in
ReplicatedMergeTree queue.

## max\_replicated\_merges\_with\_ttl\_in\_queue[​](#max_replicated_merges_with_ttl_in_queue "Direct link to max_replicated_merges_with_ttl_in_queue")

How many tasks of merging parts with TTL are allowed simultaneously in
ReplicatedMergeTree queue.

## max\_replicated\_mutations\_in\_queue[​](#max_replicated_mutations_in_queue "Direct link to max_replicated_mutations_in_queue")

How many tasks of mutating parts are allowed simultaneously in
ReplicatedMergeTree queue.

## max\_replicated\_sends\_network\_bandwidth[​](#max_replicated_sends_network_bandwidth "Direct link to max_replicated_sends_network_bandwidth")

Limits the maximum speed of data exchange over the network in bytes per
second for [replicated](/docs/engines/table-engines/mergetree-family/replacingmergetree)
sends. This setting is applied to a particular table, unlike the
[`max_replicated_sends_network_bandwidth_for_server`](/docs/operations/settings/merge-tree-settings#max_replicated_sends_network_bandwidth)
setting, which is applied to the server.

You can limit both server network and network for a particular table, but
for this the value of the table-level setting should be less than
server-level one. Otherwise the server considers only the
`max_replicated_sends_network_bandwidth_for_server` setting.

The setting isn't followed perfectly accurately.

Possible values:

- Positive integer.
- `0` — Unlimited.

**Usage**

Could be used for throttling speed when replicating data to add or replace
new nodes.

## max\_suspicious\_broken\_parts[​](#max_suspicious_broken_parts "Direct link to max_suspicious_broken_parts")

If the number of broken parts in a single partition exceeds the
`max_suspicious_broken_parts` value, automatic deletion is denied.

Possible values:

- Any positive integer.

## max\_suspicious\_broken\_parts\_bytes[​](#max_suspicious_broken_parts_bytes "Direct link to max_suspicious_broken_parts_bytes")

Max size of all broken parts, if more - deny automatic deletion.

Possible values:

- Any positive integer.

## max\_uncompressed\_bytes\_in\_patches[​](#max_uncompressed_bytes_in_patches "Direct link to max_uncompressed_bytes_in_patches")

The maximum uncompressed size of data in all patch parts in bytes.
If amount of data in all patch parts exceeds this value, lightweight updates will be rejected.
0 - unlimited.

## merge\_max\_block\_size[​](#merge_max_block_size "Direct link to merge_max_block_size")

The number of rows that are read from the merged parts into memory.

Possible values:

- Any positive integer.

Merge reads rows from parts in blocks of `merge_max_block_size` rows, then
merges and writes the result into a new part. The read block is placed in RAM,
so `merge_max_block_size` affects the size of the RAM required for the merge.
Thus, merges can consume a large amount of RAM for tables with very wide rows
(if the average row size is 100kb, then when merging 10 parts,
(100kb \* 10 \* 8192) = ~ 8GB of RAM). By decreasing `merge_max_block_size`,
you can reduce the amount of RAM required for a merge but slow down a merge.

## merge\_max\_block\_size\_bytes[​](#merge_max_block_size_bytes "Direct link to merge_max_block_size_bytes")

How many bytes in blocks should be formed for merge operations. By default
has the same value as `index_granularity_bytes`.

## merge\_max\_bytes\_to\_prewarm\_cache[​](#merge_max_bytes_to_prewarm_cache "Direct link to merge_max_bytes_to_prewarm_cache")

Only available in ClickHouse Cloud. Maximal size of part (compact or packed)
to prewarm cache during merge.

## merge\_max\_dynamic\_subcolumns\_in\_compact\_part[​](#merge_max_dynamic_subcolumns_in_compact_part "Direct link to merge_max_dynamic_subcolumns_in_compact_part")

The maximum number of dynamic subcolumns that can be created in every column in the Compact data part after merge.
It allows to control the number of dynamic subcolumns in Compact part regardless of dynamic parameters specified in the data type.