> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.mintlify.site/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.

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["Version", "Default value", "Comment"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        Version history
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>Type</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>Default</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          Changeable without restart
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

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

<h2 id="max_avg_part_size_for_too_many_parts">
  max\_avg\_part\_size\_for\_too\_many\_parts
</h2>

<SettingsInfoBlock type="UInt64" default_value="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.

<h2 id="max_buckets_in_map">
  max\_buckets\_in\_map
</h2>

<SettingsInfoBlock type="NonZeroUInt64" default_value="32" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "32"},{"label": "Add a setting to control the maximum number of buckets for 'with_buckets' Map serialization"}]}]} />

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](/reference/settings/merge-tree-settings/map-buckets#map_buckets_strategy).
The maximum allowed value is 256.

<h2 id="max_cleanup_delay_period">
  max\_cleanup\_delay\_period
</h2>

<SettingsInfoBlock type="UInt64" default_value="300" />

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

<h2 id="max_compress_block_size">
  max\_compress\_block\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="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](/reference/settings/merge-tree-settings/max#max_compress_block_size)
setting). The value specified when the table is created overrides the global
value for this setting.

<h2 id="max_concurrent_queries">
  max\_concurrent\_queries
</h2>

<SettingsInfoBlock type="UInt64" default_value="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>
```

<h2 id="max_digestion_size_per_segment">
  max\_digestion\_size\_per\_segment
</h2>

<SettingsInfoBlock type="UInt64" default_value="268435456" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "268435456"},{"label": "Obsolete setting"}]}]} />

Obsolete setting, does nothing.

<h2 id="max_file_name_length">
  max\_file\_name\_length
</h2>

<SettingsInfoBlock type="UInt64" default_value="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.

<h2 id="max_partitions_to_read">
  max\_partitions\_to\_read
</h2>

<SettingsInfoBlock type="Int64" default_value="-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](/reference/settings/session-settings/max-partitions#max_partitions_to_read)
at a query / session / profile level.

<h2 id="max_projections">
  max\_projections
</h2>

<SettingsInfoBlock type="UInt64" default_value="25" />

The maximum number of merge tree projections.

<h2 id="max_table_size_bytes_compressed">
  max\_table\_size\_bytes\_compressed
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.9"},{"label": "0"},{"label": "New setting to limit the total number of compressed bytes across all active and inactive data parts of the table."}]}]} />

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.

<h2 id="max_table_size_bytes_uncompressed">
  max\_table\_size\_bytes\_uncompressed
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.9"},{"label": "0"},{"label": "New setting to limit the total number of uncompressed bytes across all active and inactive data parts of the table."}]}]} />

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.

<h2 id="max_table_size_rows">
  max\_table\_size\_rows
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.9"},{"label": "0"},{"label": "New setting to limit the total number of rows in active data parts of the table."}]}]} />

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.

<h2 id="max_uncompressed_bytes_in_patches">
  max\_uncompressed\_bytes\_in\_patches
</h2>

<SettingsInfoBlock type="UInt64" default_value="32212254720" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "32212254720"},{"label": "New setting"}]}]} />

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.
