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

# max_* MergeTree table settings

> ClickHouse MergeTree table settings in the max_* generated group.

These settings are available in [system.merge\_tree\_settings](https://clickhouse.com/docs/reference/system-tables/merge_tree_settings.md) and are autogenerated from ClickHouse source.

## max\_avg\_part\_size\_for\_too\_many\_parts

Type

UInt64

Default

1073741824

The 'too many parts' check according to 'parts\_to\_delay\_insert' and
'parts\_to\_throw\_insert' will be active only if the average part size (in the
relevant partition) is not larger than the specified threshold. If it is
larger than the specified threshold, the INSERTs will be neither delayed or
rejected. This allows to have hundreds of terabytes in a single table on a
single server if the parts are successfully merged to larger parts. This
does not affect the thresholds on inactive parts or total parts.

## max\_buckets\_in\_map

Type

NonZeroUInt64

Default

32

The maximum number of buckets for `Map` serialization. Works with `with_buckets` `Map` serialization.
The actual number of buckets is determined by [map\_buckets\_strategy](https://clickhouse.com/docs/reference/settings/merge-tree-settings/map-buckets.md#map_buckets_strategy).
The maximum allowed value is 256.

## max\_cleanup\_delay\_period

Type

UInt64

Default

300

Maximum period to clean old queue logs, blocks hashes and parts.

## max\_compress\_block\_size

Type

UInt64

Default

0

The maximum size of blocks of uncompressed data before compressing for writing
to a table. You can also specify this setting in the global settings
(see [max\_compress\_block\_size](https://clickhouse.com/docs/reference/settings/merge-tree-settings/max.md#max_compress_block_size)
setting). The value specified when the table is created overrides the global
value for this setting.

For a column of fixed-size values the block size is rounded down to a multiple of the value size in bytes, but not below one value.

## max\_concurrent\_queries

Type

UInt64

Default

0

Max number of concurrently executed queries related to the MergeTree table.
Queries will still be limited by other `max_concurrent_queries` settings.

Possible values:

* Positive integer.
* `0` — No limit.

Default value: `0` (no limit).

**Example**

```xml theme={null}
<max_concurrent_queries>50</max_concurrent_queries>
```

## max\_digestion\_size\_per\_segment

Type

UInt64

Default

268435456

Obsolete setting, does nothing.

## max\_file\_name\_length

Type

UInt64

Default

127

The maximal length of the file name to keep it as is without hashing.
Takes effect only if setting `replace_long_file_name_to_hash` is enabled.
The value of this setting does not include the length of file extension. So,
it is recommended to set it below the maximum filename length (usually 255
bytes) with some gap to avoid filesystem errors.

## max\_partitions\_to\_read

Type

Int64

Default

-1

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](https://clickhouse.com/docs/reference/settings/session-settings/max-partitions.md#max_partitions_to_read)
at a query / session / profile level.

## max\_projections

Type

UInt64

Default

25

The maximum number of merge tree projections.

## max\_row\_mask\_update\_coalescing\_ast\_bytes

Type

UInt64

Default

1048576

Maximum sum of the original commands' `ast_text` bytes eligible for row-mask
update coalescing. The command-count limit alone cannot bound this copy when
commands contain large literals. Set to 0 to disable coalescing.

## max\_row\_mask\_update\_coalescing\_commands

Type

UInt64

Default

4096

Maximum number of part-local mutation commands eligible for row-mask update
coalescing. This bounds the extra command-list copy made by the optimization;
the value is a resource guard, not a semantic limit. Values below 2 disable
coalescing.

## max\_row\_mask\_update\_coalescing\_key\_bytes

Type

UInt64

Default

65536

Maximum total number of key-literal bytes in one coalesced row-mask update.
This bounds the size of the generated `IN` predicate. Set to 0 to disable
coalescing.

## max\_row\_mask\_update\_coalescing\_keys

Type

UInt64

Default

256

Maximum number of keys in one coalesced row-mask update. The effective limit
also respects `max_rows_in_set` in the background query settings. Values below
2 disable coalescing.

## max\_table\_size\_bytes\_compressed

Type

UInt64

Default

0

If the total number of compressed bytes (the size on disk) across all active
and inactive data parts of the table exceeds this value, an `INSERT` is
interrupted with the `Table size limit exceeded` exception. Inactive parts
are counted as well because the purpose of this setting is to limit disk
usage. Note that inactive parts are removed in the background (see the
`old_parts_lifetime` setting), so the observed size can decrease over time.
The limit is checked at the beginning of `INSERT` and when new data parts
are committed to the working set, including the results of background merges
and mutations. Inserts done by materialized views are also checked. The
limit is not checked on replicated fetches, which permits a race condition
when parallel inserts into multiple replicas overdraft the limit. Committing
empty data parts is always allowed, so the data can be removed from a table
that exceeds the limit, e.g. with `TRUNCATE` or `ALTER TABLE ... DROP
PARTITION`.

Possible values:

* Any positive integer.
* 0 — unlimited.

It is useful for multi-tenant, temporary, and demo services.

## max\_table\_size\_bytes\_uncompressed

Type

UInt64

Default

0

The same as `max_table_size_bytes_compressed`, but the limit is applied to
the total number of uncompressed bytes across all active and inactive data
parts of the table.

Possible values:

* Any positive integer.
* 0 — unlimited.

It is useful for multi-tenant, temporary, and demo services.

## max\_table\_size\_rows

Type

UInt64

Default

0

If the total number of rows in active data parts of the table exceeds this
value, an `INSERT` is interrupted with the `Table size limit exceeded`
exception. The limit is checked at the beginning of `INSERT` and when new
data parts are committed to the working set, including the results of
background merges and mutations (so a mutation that increases the table size
beyond the limit will be retried without finishing). Inserts done by
materialized views are also checked. The limit is not checked on replicated
fetches, which permits a race condition when parallel inserts into multiple
replicas overdraft the limit. Committing empty data parts is always allowed,
so the data can be removed from a table that exceeds the limit, e.g. with
`TRUNCATE` or `ALTER TABLE ... DROP PARTITION`.

Possible values:

* Any positive integer.
* 0 — unlimited.

It is useful for multi-tenant, temporary, and demo services.

## max\_uncompressed\_bytes\_in\_patches

Type

UInt64

Default

32212254720

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.
