> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Settings for MergeTree which are in `system.merge_tree_settings`

# MergeTree tables settings

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  const cells = [["Type", <Badge color="surface">{type}</Badge>], ["Default value", <Badge color="surface">{default_value}</Badge>]];
  if (changeable_without_restart) {
    const isYes = String(changeable_without_restart).trim().toLowerCase() === "yes";
    const badge = isYes ? <Badge icon="check" stroke color="green" size="sm">Yes</Badge> : <Badge icon="x" stroke color="red" size="sm">No</Badge>;
    cells.push(["Changeable without restart", badge]);
  }
  return <table>
      <thead>
        <tr>
          {cells.map(([h]) => <th key={h}>{h}</th>)}
        </tr>
      </thead>
      <tbody>
        <tr>
          {cells.map(([h, v]) => <td key={h}>{v}</td>)}
        </tr>
      </tbody>
    </table>;
};

export const galaxyOnClick = eventName => () => {
  try {
    if (typeof window !== "undefined" && window.galaxy && eventName) {
      window.galaxy.track(eventName, {
        interaction: "click"
      });
    }
  } catch (e) {}
};

export const BetaBadge = ({link, galaxyTrack, galaxyEvent}) => {
  if (link) {
    return <a href={link} target="_blank" rel="noopener noreferrer" className="betaBadge" onClick={galaxyTrack && galaxyEvent ? galaxyOnClick(galaxyEvent) : undefined}>
                <Icon />
                <span>Beta</span>
            </a>;
  }
  return <div className="betaBadge">
            <Icon />
            <span>
                Beta feature. 
                <u>
                    <a href="/docs/beta-and-experimental-features#beta-features">
                        Learn more.
                    </a>
                </u>
            </span>
        </div>;
};

export const ExperimentalBadge = () => {
  return <div className="experimentalBadge">
            <div className="experimentalIcon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path strokeWidth="1.25" d="M5.5 2H10.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
                <path strokeWidth="1.25" d="M9.50015 2V6.19625L13.4283 12.7425C13.4738 12.8183 13.4985 12.9049 13.4996 12.9934C13.5008 13.0818 13.4785 13.169 13.435 13.246C13.3914 13.323 13.3283 13.3871 13.2519 13.4317C13.1755 13.4764 13.0886 13.4999 13.0002 13.5H3.00015C2.91164 13.5 2.8247 13.4766 2.74822 13.432C2.67174 13.3874 2.60847 13.3233 2.56487 13.2463C2.52126 13.1693 2.49889 13.082 2.50004 12.9935C2.50119 12.905 2.52582 12.8184 2.5714 12.7425L6.50015 6.19625V2" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
                <path strokeWidth="1.25" d="M4.47656 9.56754C5.30344 9.41254 6.47656 9.47942 7.99969 10.25C10.0153 11.2707 11.4216 11.0569 12.2184 10.7282" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
            </svg>
        </div>
            Experimental feature. <u><a href="/docs/beta-and-experimental-features#experimental-features">Learn more.</a></u>
        </div>;
};

System table `system.merge_tree_settings` shows the globally set MergeTree settings.

MergeTree settings can be set in the `merge_tree` section of the server config file, or specified for each `MergeTree` table individually in
the `SETTINGS` clause of the `CREATE TABLE` statement.

Example for customizing setting `max_suspicious_broken_parts`:

Configure the default for all `MergeTree` tables in the server configuration file:

```text theme={null}
<merge_tree>
    <max_suspicious_broken_parts>5</max_suspicious_broken_parts>
</merge_tree>
```

Set for a particular table:

```sql theme={null}
CREATE TABLE tab
(
    `A` Int64
)
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS max_suspicious_broken_parts = 500;
```

Change the settings for a particular table using `ALTER TABLE ... MODIFY SETTING`:

```sql theme={null}
ALTER TABLE tab MODIFY SETTING max_suspicious_broken_parts = 100;

-- reset to global default (value from system.merge_tree_settings)
ALTER TABLE tab RESET SETTING max_suspicious_broken_parts;
```

<h2 id="mergetree-settings">
  MergeTree settings
</h2>

<h2 id="adaptive_write_buffer_initial_size">
  adaptive\_write\_buffer\_initial\_size
</h2>

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

Initial size of an adaptive write buffer

<h2 id="add_implicit_sign_column_constraint_for_collapsing_engine">
  add\_implicit\_sign\_column\_constraint\_for\_collapsing\_engine
</h2>

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

If true, adds an implicit constraint for the `sign` column of a CollapsingMergeTree
or VersionedCollapsingMergeTree table to allow only valid values (`1` and `-1`).

<h2 id="add_minmax_index_for_block_number_column">
  add\_minmax\_index\_for\_block\_number\_column
</h2>

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

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

When enabled, an implicit min-max (skipping) index is added for the persistent virtual column `_block_number`.
Requires `enable_block_number_column = 1` to take effect. The index is built only during merges,
not during inserts: at insert time the block number is provisional and would index a constant.

<h2 id="add_minmax_index_for_block_offset_column">
  add\_minmax\_index\_for\_block\_offset\_column
</h2>

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

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

When enabled, an implicit min-max (skipping) index is added for the persistent virtual column `_block_offset`.
Requires `enable_block_offset_column = 1` to take effect. The index is built only during merges,
not during inserts.

<h2 id="add_minmax_index_for_numeric_columns">
  add\_minmax\_index\_for\_numeric\_columns
</h2>

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

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

When enabled, min-max (skipping) indices are added for all numeric columns
of the table.

<h2 id="add_minmax_index_for_string_columns">
  add\_minmax\_index\_for\_string\_columns
</h2>

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

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

When enabled, min-max (skipping) indices are added for all string columns of the table.

<h2 id="add_minmax_index_for_temporal_columns">
  add\_minmax\_index\_for\_temporal\_columns
</h2>

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

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

When enabled, min-max (skipping) indices are added for all Date, Date32, Time, Time64, DateTime and DateTime64 columns of the table

<h2 id="allow_coalescing_columns_in_partition_or_order_key">
  allow\_coalescing\_columns\_in\_partition\_or\_order\_key
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "0"},{"label": "New setting to allow coalescing of partition or sorting key columns."}]}]} />

When enabled, allows coalescing columns in a CoalescingMergeTree table to be used in
the partition or sorting key.

<h2 id="allow_commit_order_projection">
  allow\_commit\_order\_projection
</h2>

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

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

Enables commit-order projections that store `_block_number` and `_block_offset` virtual columns, preserving original insertion order through merges.
Requires `enable_block_number_column` and `enable_block_offset_column` to be enabled.

<h2 id="allow_experimental_replacing_merge_with_cleanup">
  allow\_experimental\_replacing\_merge\_with\_cleanup
</h2>

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

Allow experimental CLEANUP merges for ReplacingMergeTree with `is_deleted`
column. When enabled, allows using `OPTIMIZE ... FINAL CLEANUP` to manually
merge all parts in a partition down to a single part and removing any
deleted rows.

Also allows enabling such merges to happen automatically in the background
with settings `min_age_to_force_merge_seconds`,
`min_age_to_force_merge_on_partition_only` and
`enable_replacing_merge_with_cleanup_for_min_age_to_force_merge`.

<h2 id="allow_experimental_reverse_key">
  allow\_experimental\_reverse\_key
</h2>

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

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

Enables support for descending sort order in MergeTree sorting keys. This
setting is particularly useful for time series analysis and Top-N queries,
allowing data to be stored in reverse chronological order to optimize query
performance.

With `allow_experimental_reverse_key` enabled, you can define descending sort
orders within the `ORDER BY` clause of a MergeTree table. This enables the
use of more efficient `ReadInOrder` optimizations instead of `ReadInReverseOrder`
for descending queries.

**Example**

```sql theme={null}
CREATE TABLE example
(
time DateTime,
key Int32,
value String
) ENGINE = MergeTree
ORDER BY (time DESC, key)  -- Descending order on 'time' field
SETTINGS allow_experimental_reverse_key = 1;

SELECT * FROM example WHERE key = 'xxx' ORDER BY time DESC LIMIT 10;
```

By using `ORDER BY time DESC` in the query, `ReadInOrder` is applied.

**Default Value:** false

<h2 id="allow_floating_point_partition_key">
  allow\_floating\_point\_partition\_key
</h2>

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

Enables to allow floating-point number as a partition key.

Possible values:

* `0` — Floating-point partition key not allowed.
* `1` — Floating-point partition key allowed.

<h2 id="allow_nullable_key">
  allow\_nullable\_key
</h2>

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

Allow Nullable types as primary keys.

<h2 id="allow_part_offset_column_in_projections">
  allow\_part\_offset\_column\_in\_projections
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "Now projections can use _part_offset column."}]}, {"id": "row-2","items": [{"label": "25.5"},{"label": "0"},{"label": "New setting, it protects from creating projections with parent part offset column until it is stabilized."}]}]} />

Allow usage of '\_part\_offset' column in projections select query.

<h2 id="allow_reduce_blocking_parts_task">
  allow\_reduce\_blocking\_parts\_task
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "1"},{"label": "Now SMT will remove stale blocking parts from ZooKeeper by default"}]}, {"id": "row-2","items": [{"label": "25.1"},{"label": "0"},{"label": "Cloud sync"}]}]} />

Background task which reduces blocking parts for shared merge tree tables.
Only in ClickHouse Cloud

<h2 id="allow_remote_fs_zero_copy_replication">
  allow\_remote\_fs\_zero\_copy\_replication
</h2>

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

Don't use this setting in production, because it is not ready.

<h2 id="allow_summing_columns_in_partition_or_order_key">
  allow\_summing\_columns\_in\_partition\_or\_order\_key
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "0"},{"label": "New setting to allow summing of partition or sorting key columns"}]}]} />

When enabled, allows summing columns in a SummingMergeTree table to be used in
the partition or sorting key.

<h2 id="allow_suspicious_indices">
  allow\_suspicious\_indices
</h2>

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

Reject primary/secondary indexes and sorting keys with identical expressions

<h2 id="allow_vertical_merges_from_compact_to_wide_parts">
  allow\_vertical\_merges\_from\_compact\_to\_wide\_parts
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Allows vertical merges from compact to wide parts. This settings must have
the same value on all replicas.

<h2 id="alter_column_secondary_index_mode">
  alter\_column\_secondary\_index\_mode
</h2>

<SettingsInfoBlock type="AlterColumnSecondaryIndexMode" default_value="rebuild" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "rebuild"},{"label": "Change the behaviour to allow ALTER `column` when they have dependent secondary indices"}]}]} />

Configures whether to allow `ALTER` commands that modify columns covered by secondary indices, and what action to take if
they are allowed. By default, such `ALTER` commands are allowed and the indices are rebuilt.

Possible values:

* `rebuild` (default): Rebuilds any secondary indices affected by the column in the `ALTER` command.
* `throw`: Prevents any `ALTER` of columns covered by **explicit** secondary indices by throwing an exception. Implicit indices are excluded from this restriction and will be rebuilt.
* `drop`: Drop the dependent secondary indices. The new parts won't have the indices, requiring `MATERIALIZE INDEX` to recreate them.
* `compatibility`: Matches the original behaviour: `throw` on `ALTER ... MODIFY COLUMN` and `rebuild` on `ALTER ... UPDATE/DELETE`.
* `ignore`: Intended for expert usage. It will leave the indices in an inconsistent state, allowing incorrect query results.

<h2 id="always_fetch_merged_part">
  always\_fetch\_merged\_part
</h2>

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

If true, this replica never merges parts and always downloads merged parts
from other replicas.

Possible values:

* true, false

<h2 id="always_use_copy_instead_of_hardlinks">
  always\_use\_copy\_instead\_of\_hardlinks
</h2>

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

Always copy data instead of hardlinking during mutations/replaces/detaches
and so on.

<h2 id="apply_patches_on_merge">
  apply\_patches\_on\_merge
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

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

If true patch parts are applied on merges

<h2 id="assign_part_uuids">
  assign\_part\_uuids
</h2>

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

When enabled, a unique part identifier will be assigned for every new part.
Before enabling, check that all replicas support UUID version 4.

<h2 id="async_block_ids_cache_update_wait_ms">
  async\_block\_ids\_cache\_update\_wait\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="100" />

How long each insert iteration will wait for async\_block\_ids\_cache update

<h2 id="async_insert">
  async\_insert
</h2>

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

If true, data from INSERT query is stored in queue and later flushed to
table in background.

<h2 id="auto_statistics_types">
  auto\_statistics\_types
</h2>

<SettingsInfoBlock type="String" default_value="minmax, uniq" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "minmax, uniq"},{"label": "Enable auto statistics by default"}]}, {"id": "row-2","items": [{"label": "25.10"},{"label": ""},{"label": "New setting"}]}]} />

Comma-separated list of statistics types to calculate automatically on all suitable columns.
Supported statistics types: tdigest, countmin, minmax, nullcount, uniq.

<h2 id="background_task_preferred_step_execution_time_ms">
  background\_task\_preferred\_step\_execution\_time\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="50" />

Target time to execution of one step of merge or mutation. Can be exceeded if
one step takes longer time

<h2 id="cache_populated_by_fetch">
  cache\_populated\_by\_fetch
</h2>

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

<Note>
  This setting applies only to ClickHouse Cloud.
</Note>

When `cache_populated_by_fetch` is disabled (the default setting), new data
parts are loaded into the filesystem cache only when a query is run that requires
those parts.

If enabled, `cache_populated_by_fetch` will instead cause all nodes to load
new data parts from storage into their filesystem cache without requiring a query
to trigger such an action.

**See Also**

* [ignore\_cold\_parts\_seconds](/reference/settings/session-settings#ignore_cold_parts_seconds)
* [prefer\_warmed\_unmerged\_parts\_seconds](/reference/settings/session-settings#prefer_warmed_unmerged_parts_seconds)
* [cache\_warmer\_threads](/reference/settings/session-settings#cache_warmer_threads)

<h2 id="cache_populated_by_fetch_filename_regexp">
  cache\_populated\_by\_fetch\_filename\_regexp
</h2>

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

<Note>
  This setting applies only to ClickHouse Cloud.
</Note>

If not empty, only files that match this regex will be prewarmed into the cache after fetch (if `cache_populated_by_fetch` is enabled).

<h2 id="check_delay_period">
  check\_delay\_period
</h2>

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

Obsolete setting, does nothing.

<h2 id="check_sample_column_is_correct">
  check\_sample\_column\_is\_correct
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enables the check at table creation, that the data type of a column for s
ampling or sampling expression is correct. The data type must be one of unsigned
[integer types](/reference/data-types/int-uint): `UInt8`, `UInt16`,
`UInt32`, `UInt64`.

Possible values:

* `true`  — The check is enabled.
* `false` — The check is disabled at table creation.

Default value: `true`.

By default, the ClickHouse server checks at table creation the data type of
a column for sampling or sampling expression. If you already have tables with
incorrect sampling expression and do not want the server to raise an exception
during startup, set `check_sample_column_is_correct` to `false`.

<h2 id="clean_deleted_rows">
  clean\_deleted\_rows
</h2>

<SettingsInfoBlock type="CleanDeletedRows" default_value="Never" />

Obsolete setting, does nothing.

<h2 id="cleanup_delay_period">
  cleanup\_delay\_period
</h2>

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

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

<h2 id="cleanup_delay_period_random_add">
  cleanup\_delay\_period\_random\_add
</h2>

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

Add uniformly distributed value from 0 to x seconds to cleanup\_delay\_period
to avoid thundering herd effect and subsequent DoS of ZooKeeper in case of
very large number of tables.

<h2 id="cleanup_thread_preferred_points_per_iteration">
  cleanup\_thread\_preferred\_points\_per\_iteration
</h2>

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

Preferred batch size for background cleanup (points are abstract but 1 point
is approximately equivalent to 1 inserted block).

<h2 id="cleanup_threads">
  cleanup\_threads
</h2>

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

Obsolete setting, does nothing.

<h2 id="clone_replica_zookeeper_create_get_part_batch_size">
  clone\_replica\_zookeeper\_create\_get\_part\_batch\_size
</h2>

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

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

Batch size for ZooKeeper multi-create get-part requests when cloning replica.

<h2 id="columns_and_secondary_indices_sizes_lazy_calculation">
  columns\_and\_secondary\_indices\_sizes\_lazy\_calculation
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "1"},{"label": "New setting to calculate columns and indices sizes lazily"}]}]} />

Calculate columns and secondary indices sizes lazily on first request instead
of on table initialization.

<h2 id="columns_to_prewarm_mark_cache">
  columns\_to\_prewarm\_mark\_cache
</h2>

List of columns to prewarm mark cache for (if enabled). Empty means all columns

<h2 id="compact_parts_max_bytes_to_buffer">
  compact\_parts\_max\_bytes\_to\_buffer
</h2>

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

Only available in ClickHouse Cloud. Maximal number of bytes to write in a
single stripe in compact parts

<h2 id="compact_parts_max_granules_to_buffer">
  compact\_parts\_max\_granules\_to\_buffer
</h2>

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

Only available in ClickHouse Cloud. Maximal number of granules to write in a
single stripe in compact parts

<h2 id="compact_parts_merge_max_bytes_to_prefetch_part">
  compact\_parts\_merge\_max\_bytes\_to\_prefetch\_part
</h2>

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

Only available in ClickHouse Cloud. Maximal size of compact part to read it
in a whole to memory during merge.

<h2 id="compatibility_allow_sampling_expression_not_in_primary_key">
  compatibility\_allow\_sampling\_expression\_not\_in\_primary\_key
</h2>

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

Allow to create a table with sampling expression not in primary key. This is
needed only to temporarily allow to run the server with wrong tables for
backward compatibility.

<h2 id="compress_marks">
  compress\_marks
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Marks support compression, reduce mark file size and speed up network
transmission.

<h2 id="compress_per_column_in_compact_parts">
  compress\_per\_column\_in\_compact\_parts
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

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

Controls the physical layout of Compact parts. If true (default), each column in a granule
starts a new compressed block, allowing ClickHouse to skip reading unnecessary columns
from disk. If false, all columns within a granule are packed into the same compressed block,
improving compression ratio but requiring more data to be decompressed during reads.
This is beneficial for workloads that always read all columns (e.g. projections).

<h2 id="compress_primary_key">
  compress\_primary\_key
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Primary key support compression, reduce primary key file size and speed up
network transmission.

<h2 id="concurrent_part_removal_threshold">
  concurrent\_part\_removal\_threshold
</h2>

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

Activate concurrent part removal (see 'max\_part\_removal\_threads') only if
the number of inactive data parts is at least this.

<h2 id="concurrent_part_removal_threshold_for_remote_disk">
  concurrent\_part\_removal\_threshold\_for\_remote\_disk
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "16"},{"label": "New setting. Lower threshold to enter the concurrent part removal path when any part being removed is on a remote disk, where each removal is typically one network round-trip. The old value (100) matches the legacy `concurrent_part_removal_threshold` default, so older `compatibility` modes preserve the previous behavior."}]}]} />

Same as `concurrent_part_removal_threshold`, but used when at least one
part being removed is stored on a remote disk. The default is lower
because each part removal on remote storage typically requires a network
round-trip (e.g. one HTTP `DELETE` per part on object storage), so a
serial removal of even 100 parts can stall a `DROP TABLE` for tens of
seconds.

<h2 id="deduplicate_merge_projection_mode">
  deduplicate\_merge\_projection\_mode
</h2>

<SettingsInfoBlock type="DeduplicateMergeProjectionMode" default_value="throw" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "throw"},{"label": "Do not allow to create inconsistent projection"}]}]} />

Whether to allow create projection for the table with non-classic MergeTree,
that is not (Replicated, Shared) MergeTree. Ignore option is purely for
compatibility which might result in incorrect answer. Otherwise, if allowed,
what is the action when merge projections, either drop or rebuild. So classic
MergeTree would ignore this setting. It also controls `OPTIMIZE DEDUPLICATE`
as well, but has effect on all MergeTree family members. Similar to the
option `lightweight_mutation_projection_mode`, it is also part level.

Possible values:

* `ignore`
* `throw`
* `drop`
* `rebuild`

<h2 id="default_compression_codec">
  default\_compression\_codec
</h2>

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

Specifies the default compression codec to be used if none is defined for a particular column in the table declaration.
Compression codec selecting order for a column:

1. Compression codec defined for the column in the table declaration
2. Compression codec defined in `default_compression_codec` (this setting)
3. Default compression codec defined in `compression` settings
   Default value: an empty string (not defined).

<h2 id="detach_not_byte_identical_parts">
  detach\_not\_byte\_identical\_parts
</h2>

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

Enables or disables detaching a data part on a replica after a merge or a
mutation, if it is not byte-identical to data parts on other replicas. If
disabled, the data part is removed. Activate this setting if you want to
analyze such parts later.

The setting is applicable to `MergeTree` tables with enabled
[data replication](/reference/engines/table-engines/mergetree-family/replacingmergetree).

Possible values:

* `0` — Parts are removed.
* `1` — Parts are detached.

<h2 id="detach_old_local_parts_when_cloning_replica">
  detach\_old\_local\_parts\_when\_cloning\_replica
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Do not remove old local parts when repairing lost replica.

Possible values:

* `true`
* `false`

<h2 id="disable_detach_partition_for_zero_copy_replication">
  disable\_detach\_partition\_for\_zero\_copy\_replication
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Disable DETACH PARTITION query for zero copy replication.

<h2 id="disable_fetch_partition_for_zero_copy_replication">
  disable\_fetch\_partition\_for\_zero\_copy\_replication
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Disable FETCH PARTITION query for zero copy replication.

<h2 id="disable_freeze_partition_for_zero_copy_replication">
  disable\_freeze\_partition\_for\_zero\_copy\_replication
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Disable FREEZE PARTITION query for zero copy replication.

<h2 id="disk">
  disk
</h2>

Name of storage disk. Can be specified instead of storage policy.

<h2 id="distributed_index_analysis_min_indexes_bytes_to_activate">
  distributed\_index\_analysis\_min\_indexes\_bytes\_to\_activate
</h2>

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

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

Minimal index sizes (data skipping and primary key) on disk (but uncompressed) to activated distributed index analysis

<h2 id="distributed_index_analysis_min_parts_to_activate">
  distributed\_index\_analysis\_min\_parts\_to\_activate
</h2>

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

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

Minimal number of parts to activated distributed index analysis

<h2 id="dynamic_serialization_version">
  dynamic\_serialization\_version
</h2>

<SettingsInfoBlock type="MergeTreeDynamicSerializationVersion" default_value="v3" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "v2"},{"label": "Add a setting to control Dynamic serialization versions"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "v3"},{"label": "Enable v3 serialization version for Dynamic by default for better serialization/deserialization"}]}]} />

Serialization version for Dynamic data type. Required for compatibility.

Possible values:

* `v1`
* `v2`
* `v3`

<h2 id="enable_block_number_column">
  enable\_block\_number\_column
</h2>

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

Enable persisting column \_block\_number for each row.

<h2 id="enable_block_offset_column">
  enable\_block\_offset\_column
</h2>

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

Persists virtual column `_block_offset` on merges.

<h2 id="enable_index_granularity_compression">
  enable\_index\_granularity\_compression
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Compress in memory values of index granularity if it is possible

<h2 id="enable_max_bytes_limit_for_min_age_to_force_merge">
  enable\_max\_bytes\_limit\_for\_min\_age\_to\_force\_merge
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "Limit part sizes even with min_age_to_force_merge_seconds by default"}]}, {"id": "row-2","items": [{"label": "25.1"},{"label": "0"},{"label": "Added new setting to limit max bytes for min_age_to_force_merge."}]}, {"id": "row-3","items": [{"label": "25.1"},{"label": "0"},{"label": "New setting"}]}]} />

If settings `min_age_to_force_merge_seconds` and
`min_age_to_force_merge_on_partition_only` should respect setting
`max_bytes_to_merge_at_max_space_in_pool`.

Possible values:

* `true`
* `false`

<h2 id="enable_mixed_granularity_parts">
  enable\_mixed\_granularity\_parts
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enables or disables transitioning to control the granule size with the
`index_granularity_bytes` setting. Before version 19.11, there was only the
`index_granularity` setting for restricting granule size. The
`index_granularity_bytes` setting improves ClickHouse performance when
selecting data from tables with big rows (tens and hundreds of megabytes).
If you have tables with big rows, you can enable this setting for the tables
to improve the efficiency of `SELECT` queries.

<h2 id="enable_replacing_merge_with_cleanup_for_min_age_to_force_merge">
  enable\_replacing\_merge\_with\_cleanup\_for\_min\_age\_to\_force\_merge
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.3"},{"label": "0"},{"label": "New setting to allow automatic cleanup merges for ReplacingMergeTree"}]}]} />

Whether to use CLEANUP merges for ReplacingMergeTree when merging partitions
down to a single part. Requires `allow_experimental_replacing_merge_with_cleanup`,
`min_age_to_force_merge_seconds` and `min_age_to_force_merge_on_partition_only`
to be enabled.

Possible values:

* `true`
* `false`

<h2 id="enable_the_endpoint_id_with_zookeeper_name_prefix">
  enable\_the\_endpoint\_id\_with\_zookeeper\_name\_prefix
</h2>

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

Enable the endpoint id with zookeeper name prefix for the replicated merge
tree table.

<h2 id="enable_vertical_merge_algorithm">
  enable\_vertical\_merge\_algorithm
</h2>

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

Enable usage of Vertical merge algorithm.

<h2 id="enforce_index_structure_match_on_partition_manipulation">
  enforce\_index\_structure\_match\_on\_partition\_manipulation
</h2>

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

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

If this setting is enabled for destination table of a partition manipulation
query (`ATTACH/MOVE/REPLACE PARTITION`), the indices and projections must be
identical between the source and destination tables. Otherwise, the destination
table can have a superset of the source table's indices and projections.

<h2 id="escape_index_filenames">
  escape\_index\_filenames
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "1"},{"label": "Escape non-ascii characters in filenames created for indices"}]}]} />

Prior to 26.1 we didn't escape special symbols in filenames created for secondary indices, which could lead to issues with some
characters in index names producing broken parts. This is added purely for compatibility reasons. It should not be changed unless you
are reading old parts with indices using non-ascii characters in their names.

<h2 id="escape_variant_subcolumn_filenames">
  escape\_variant\_subcolumn\_filenames
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1"},{"label": "Escape special symbols for filenames created for Variant type subcolumns in Wide parts"}]}]} />

Escape special symbols in filenames created for subcolumns of Variant data type in Wide parts of MergeTree table. Needed for compatibility.

<h2 id="exclude_deleted_rows_for_part_size_in_merge">
  exclude\_deleted\_rows\_for\_part\_size\_in\_merge
</h2>

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

If enabled, estimated actual size of data parts (i.e., excluding those rows
that have been deleted through `DELETE FROM`) will be used when selecting
parts to merge. Note that this behavior is only triggered for data parts
affected by `DELETE FROM` executed after this setting is enabled.

Possible values:

* `true`
* `false`

**See Also**

* [load\_existing\_rows\_count\_for\_old\_parts](#load_existing_rows_count_for_old_parts)
  setting

<h2 id="exclude_materialize_skip_indexes_on_merge">
  exclude\_materialize\_skip\_indexes\_on\_merge
</h2>

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

Excludes provided comma delimited list of skip indexes from being built and stored during merges. Has no effect if
[materialize\_skip\_indexes\_on\_merge](#materialize_skip_indexes_on_merge) is false.

The excluded skip indexes will still be built and stored by an explicit
[MATERIALIZE INDEX](/reference/statements/alter/skipping-index#materialize-index) query or during INSERTs depending on
the [materialize\_skip\_indexes\_on\_insert](/reference/settings/session-settings#materialize_skip_indexes_on_insert)
session setting.

Example:

```sql theme={null}
CREATE TABLE tab
(
a UInt64,
b UInt64,
INDEX idx_a a TYPE minmax,
INDEX idx_b b TYPE set(3)
)
ENGINE = MergeTree ORDER BY tuple() SETTINGS exclude_materialize_skip_indexes_on_merge = 'idx_a';

INSERT INTO tab SELECT number, number / 50 FROM numbers(100); -- setting has no effect on INSERTs

-- idx_a will be excluded from update during background or explicit merge via OPTIMIZE TABLE FINAL

-- can exclude multiple indexes by providing a list
ALTER TABLE tab MODIFY SETTING exclude_materialize_skip_indexes_on_merge = 'idx_a, idx_b';

-- default setting, no indexes excluded from being updated during merge
ALTER TABLE tab MODIFY SETTING exclude_materialize_skip_indexes_on_merge = '';
```

<h2 id="execute_merges_on_single_replica_time_threshold">
  execute\_merges\_on\_single\_replica\_time\_threshold
</h2>

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

When this setting has a value greater than zero, only a single replica starts
the merge immediately, and other replicas wait up to that amount of time to
download the result instead of doing merges locally. If the chosen replica
doesn't finish the merge during that amount of time, fallback to standard
behavior happens.

Possible values:

* Any positive integer.

<h2 id="fault_probability_after_part_commit">
  fault\_probability\_after\_part\_commit
</h2>

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

For testing. Do not change it.

<h2 id="fault_probability_before_part_commit">
  fault\_probability\_before\_part\_commit
</h2>

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

For testing. Do not change it.

<h2 id="finished_mutations_to_keep">
  finished\_mutations\_to\_keep
</h2>

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

How many records about mutations that are done to keep. If zero, then keep
all of them.

<h2 id="force_read_through_cache_for_merges">
  force\_read\_through\_cache\_for\_merges
</h2>

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

Force read-through filesystem cache for merges

<h2 id="fsync_after_insert">
  fsync\_after\_insert
</h2>

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

Do fsync for every inserted part. Significantly decreases performance of
inserts, not recommended to use with wide parts.

<h2 id="fsync_part_directory">
  fsync\_part\_directory
</h2>

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

Do fsync for part directory after all part operations (writes, renames, etc.).

<h2 id="in_memory_parts_enable_wal">
  in\_memory\_parts\_enable\_wal
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Obsolete setting, does nothing.

<h2 id="in_memory_parts_insert_sync">
  in\_memory\_parts\_insert\_sync
</h2>

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

Obsolete setting, does nothing.

<h2 id="inactive_parts_to_delay_insert">
  inactive\_parts\_to\_delay\_insert
</h2>

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

If the number of inactive parts in a single partition in the table exceeds
the `inactive_parts_to_delay_insert` value, an `INSERT` is artificially
slowed down.

<Tip>
  It is useful when a server fails to clean up parts quickly enough.
</Tip>

Possible values:

* Any positive integer.

<h2 id="inactive_parts_to_throw_insert">
  inactive\_parts\_to\_throw\_insert
</h2>

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

If the number of inactive parts in a single partition more than the
`inactive_parts_to_throw_insert` value, `INSERT` is interrupted with the
following error:

> "Too many inactive parts (N). Parts cleaning are processing significantly
> slower than inserts" exception."

Possible values:

* Any positive integer.

<h2 id="index_granularity">
  index\_granularity
</h2>

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

Maximum number of data rows between the marks of an index. I.e how many rows
correspond to one primary key value.

<h2 id="index_granularity_bytes">
  index\_granularity\_bytes
</h2>

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

Maximum size of data granules in bytes.

To restrict the granule size only by number of rows, set to `0` (not recommended).

<h2 id="initialization_retry_period">
  initialization\_retry\_period
</h2>

<SettingsInfoBlock type="Seconds" default_value="60" />

Retry period for table initialization, in seconds.

<h2 id="kill_delay_period">
  kill\_delay\_period
</h2>

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

Obsolete setting, does nothing.

<h2 id="kill_delay_period_random_add">
  kill\_delay\_period\_random\_add
</h2>

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

Obsolete setting, does nothing.

<h2 id="kill_threads">
  kill\_threads
</h2>

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

Obsolete setting, does nothing.

<h2 id="lightweight_mutation_projection_mode">
  lightweight\_mutation\_projection\_mode
</h2>

<SettingsInfoBlock type="LightweightMutationProjectionMode" default_value="throw" />

By default, lightweight delete `DELETE` does not work for tables with
projections. This is because rows in a projection may be affected by a
`DELETE` operation. So the default value would be `throw`. However, this
option can change the behavior. With the value either `drop` or `rebuild`,
deletes will work with projections. `drop` would delete the projection so it
might be fast in the current query as projection gets deleted but slow in
future queries as no projection attached. `rebuild` would rebuild the
projection which might affect the performance of the current query, but
might speedup for future queries. A good thing is that these options would
only work in the part level, which means projections in the part that don't
get touched would stay intact instead of triggering any action like
drop or rebuild.

Possible values:

* `throw`
* `drop`
* `rebuild`

<h2 id="load_existing_rows_count_for_old_parts">
  load\_existing\_rows\_count\_for\_old\_parts
</h2>

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

If enabled along with [exclude\_deleted\_rows\_for\_part\_size\_in\_merge](#exclude_deleted_rows_for_part_size_in_merge),
deleted rows count for existing data parts will be calculated during table
starting up. Note that it may slow down start up table loading.

Possible values:

* `true`
* `false`

**See Also**

* [exclude\_deleted\_rows\_for\_part\_size\_in\_merge](#exclude_deleted_rows_for_part_size_in_merge) setting

<h2 id="lock_acquire_timeout_for_background_operations">
  lock\_acquire\_timeout\_for\_background\_operations
</h2>

<SettingsInfoBlock type="Seconds" default_value="120" />

For background operations like merges, mutations etc. How many seconds before
failing to acquire table locks.

<h2 id="map_buckets_coefficient">
  map\_buckets\_coefficient
</h2>

<SettingsInfoBlock type="Float" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "1"},{"label": "Add a setting to control the coefficient used in `sqrt` and `linear` strategy for calculating the number of buckets for 'with_buckets' Map serialization"}]}]} />

The coefficient used in `sqrt` and `linear` [map\_buckets\_strategy](#map_buckets_strategy) to calculate the number of buckets from the average map size.
For `sqrt` strategy: `round(map_buckets_coefficient * sqrt(avg_map_size))`.
For `linear` strategy: `round(map_buckets_coefficient * avg_map_size)`.
Ignored when `map_buckets_strategy` is `constant`.

<h2 id="map_buckets_min_avg_size">
  map\_buckets\_min\_avg\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "32"},{"label": "Add a setting to control the minimum average map size (number of keys per row) required to apply `with_buckets` serialization"}]}]} />

The minimum average map size (number of keys per row) required to apply `with_buckets` serialization.
If the average map size is less than this value, a single bucket is used regardless of other bucket settings.
A value of `0` disables the threshold and always applies the bucketing strategy.
This setting is useful to avoid the overhead of bucketed serialization for small maps where the benefit is negligible.

<h2 id="map_buckets_strategy">
  map\_buckets\_strategy
</h2>

<SettingsInfoBlock type="MergeTreeMapBucketsStrategy" default_value="sqrt" />

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

Controls the strategy for choosing the number of buckets in `with_buckets` `Map` serialization based on the average map size.

Possible values:

* constant — Always use [max\_buckets\_in\_map](#max_buckets_in_map) as the number of buckets, regardless of the average map size.
* sqrt — Use `round(map_buckets_coefficient * sqrt(avg_map_size))` as the number of buckets, clamped to `[1, max_buckets_in_map]`.
* linear — Use `round(map_buckets_coefficient * avg_map_size)` as the number of buckets, clamped to `[1, max_buckets_in_map]`.

<h2 id="map_serialization_version">
  map\_serialization\_version
</h2>

<SettingsInfoBlock type="MergeTreeMapSerializationVersion" default_value="basic" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "basic"},{"label": "Add a setting to control Map serialization version"}]}]} />

Controls the serialization method used for `Map` columns.

Possible values:

* basic — Use the standard serialization for `Map`.
* with\_buckets — Split keys into buckets during serialization. Using buckets improves reading individual keys from the Map.

The number of buckets in `with_buckets` serialization is determined by [max\_buckets\_in\_map](#max_buckets_in_map) and [map\_buckets\_strategy](#map_buckets_strategy).

<h2 id="map_serialization_version_for_zero_level_parts">
  map\_serialization\_version\_for\_zero\_level\_parts
</h2>

<SettingsInfoBlock type="MergeTreeMapSerializationVersion" default_value="basic" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "basic"},{"label": "Add a setting to control Map serialization version for zero-level parts"}]}]} />

This setting allows to specify a different serialization version of
`Map` columns for zero level parts that are created during inserts.
It can be useful to keep `basic` serialization for zero level parts to avoid
performance degradation during inserts, while using `with_buckets` for merged parts.

<h2 id="marks_compress_block_size">
  marks\_compress\_block\_size
</h2>

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

Mark compress block size, the actual size of the block to compress.

<h2 id="marks_compression_codec">
  marks\_compression\_codec
</h2>

<SettingsInfoBlock type="String" default_value="ZSTD(3)" />

Compression encoding used by marks, marks are small enough and cached, so
the default compression is ZSTD(3).

<h2 id="materialize_skip_indexes_on_merge">
  materialize\_skip\_indexes\_on\_merge
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

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

When enabled, merges build and store skip indices for new parts.
Otherwise they can be created/stored by explicit [MATERIALIZE INDEX](/reference/statements/alter/skipping-index#materialize-index)
or [during INSERTs](/reference/settings/session-settings#materialize_skip_indexes_on_insert).

See also [exclude\_materialize\_skip\_indexes\_on\_merge](#exclude_materialize_skip_indexes_on_merge) for more fine-grained control.

<h2 id="materialize_statistics_on_merge">
  materialize\_statistics\_on\_merge
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

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

When enabled, merges will build and store statistics for new parts.
Otherwise they can be created/stored by explicit [MATERIALIZE STATISTICS](/reference/statements/alter/statistics)
or [during INSERTs](/reference/settings/session-settings#materialize_statistics_on_insert)

<h2 id="materialize_ttl_recalculate_only">
  materialize\_ttl\_recalculate\_only
</h2>

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

Only recalculate ttl info when MATERIALIZE TTL

<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](#map_buckets_strategy).
The maximum allowed value is 256.

<h2 id="max_bytes_to_merge_at_max_space_in_pool">
  max\_bytes\_to\_merge\_at\_max\_space\_in\_pool
</h2>

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

The maximum total parts size (in bytes) to be merged into one part, if there
are enough resources available. Corresponds roughly to the maximum possible
part size created by an automatic background merge. (0 means merges will be disabled)

Possible values:

* Any non-negative integer.

The merge scheduler periodically analyzes the sizes and number of parts in
partitions, and if there are enough free resources in the pool, it starts
background merges. Merges occur until the total size of the source parts is
larger than `max_bytes_to_merge_at_max_space_in_pool`.

Merges initiated by [OPTIMIZE FINAL](/reference/statements/optimize)
ignore `max_bytes_to_merge_at_max_space_in_pool` (only the free disk space
is taken into account).

<h2 id="max_bytes_to_merge_at_min_space_in_pool">
  max\_bytes\_to\_merge\_at\_min\_space\_in\_pool
</h2>

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

The maximum total part size (in bytes) to be merged into one part, with the
minimum available resources in the background pool.

Possible values:

* Any positive integer.

`max_bytes_to_merge_at_min_space_in_pool` defines the maximum total size of
parts which can be merged despite the lack of available disk space (in pool).
This is necessary to reduce the number of small parts and the chance of
`Too many parts` errors.
Merges book disk space by doubling the total merged parts sizes.
Thus, with a small amount of free disk space, a situation may occur in which
there is free space, but this space is already booked by ongoing large merges,
so other merges are unable to start, and the number of small parts grows
with every insert.

<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_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_delay_to_insert">
  max\_delay\_to\_insert
</h2>

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

The value in seconds, which is used to calculate the `INSERT` delay, if the
number of active parts in a single partition exceeds the
[parts\_to\_delay\_insert](#parts_to_delay_insert) value.

Possible values:

* Any positive integer.

The delay (in milliseconds) for `INSERT` is calculated by the formula:

```code theme={null}
max_k = parts_to_throw_insert - parts_to_delay_insert
k = 1 + parts_count_in_partition - parts_to_delay_insert
delay_milliseconds = pow(max_delay_to_insert * 1000, k / max_k)
```

For example, if a partition has 299 active parts and parts\_to\_throw\_insert
\= 300, parts\_to\_delay\_insert = 150, max\_delay\_to\_insert = 1, `INSERT` is
delayed for `pow( 1 * 1000, (1 + 299 - 150) / (300 - 150) ) = 1000`
milliseconds.

Starting from version 23.1 formula has been changed to:

```code theme={null}
allowed_parts_over_threshold = parts_to_throw_insert - parts_to_delay_insert
parts_over_threshold = parts_count_in_partition - parts_to_delay_insert + 1
delay_milliseconds = max(min_delay_to_insert_ms, (max_delay_to_insert * 1000)
* parts_over_threshold / allowed_parts_over_threshold)
```

For example, if a partition has 224 active parts and parts\_to\_throw\_insert
\= 300, parts\_to\_delay\_insert = 150, max\_delay\_to\_insert = 1,
min\_delay\_to\_insert\_ms = 10, `INSERT` is delayed for `max( 10, 1 * 1000 *
(224 - 150 + 1) / (300 - 150) ) = 500` milliseconds.

<h2 id="max_delay_to_mutate_ms">
  max\_delay\_to\_mutate\_ms
</h2>

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

Max delay of mutating MergeTree table in milliseconds, if there are a lot of
unfinished mutations

<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_files_to_modify_in_alter_columns">
  max\_files\_to\_modify\_in\_alter\_columns
</h2>

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

Do not apply ALTER if number of files for modification(deletion, addition)
is greater than this setting.

Possible values:

* Any positive integer.

Default value: 75

<h2 id="max_files_to_remove_in_alter_columns">
  max\_files\_to\_remove\_in\_alter\_columns
</h2>

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

Do not apply ALTER, if the number of files for deletion is greater than this
setting.

Possible values:

* Any positive integer.

<h2 id="max_merge_delayed_streams_for_parallel_write">
  max\_merge\_delayed\_streams\_for\_parallel\_write
</h2>

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

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

The maximum number of streams (columns) that can be flushed in parallel
(analog of max\_insert\_delayed\_streams\_for\_parallel\_write for merges). Works
only for Vertical merges.

<h2 id="max_merge_selecting_sleep_ms">
  max\_merge\_selecting\_sleep\_ms
</h2>

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

Maximum time to wait before trying to select parts to merge again after no
parts were selected. A lower setting will trigger selecting tasks in
background\_schedule\_pool frequently which result in large amount of
requests to zookeeper in large-scale clusters

<h2 id="max_number_of_merges_with_ttl_in_pool">
  max\_number\_of\_merges\_with\_ttl\_in\_pool
</h2>

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

When there is
more than specified number of merges with TTL entries in pool, do not assign
new merge with TTL. This is to leave free threads for regular merges and
avoid "Too many parts"

<h2 id="max_number_of_mutations_for_replica">
  max\_number\_of\_mutations\_for\_replica
</h2>

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

Limit the number of part mutations per replica to the specified amount.
Zero means no limit on the number of mutations per replica (the execution can
still be constrained by other settings).

<h2 id="max_part_loading_threads">
  max\_part\_loading\_threads
</h2>

<SettingsInfoBlock type="MaxThreads" default_value="'auto(14)'" />

Obsolete setting, does nothing.

<h2 id="max_part_removal_threads">
  max\_part\_removal\_threads
</h2>

<SettingsInfoBlock type="MaxThreads" default_value="'auto(14)'" />

Obsolete setting, does nothing.

<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_to_read)
at a query / session / profile level.

<h2 id="max_parts_in_total">
  max\_parts\_in\_total
</h2>

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

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).

<h2 id="max_parts_to_merge_at_once">
  max\_parts\_to\_merge\_at\_once
</h2>

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

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

<h2 id="max_postpone_time_for_failed_mutations_ms">
  max\_postpone\_time\_for\_failed\_mutations\_ms
</h2>

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

The maximum postpone time for failed mutations.

<h2 id="max_postpone_time_for_failed_replicated_fetches_ms">
  max\_postpone\_time\_for\_failed\_replicated\_fetches\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "60000"},{"label": "Added new setting to enable postponing fetch tasks in the replication queue."}]}]} />

The maximum postpone time for failed replicated fetches.

<h2 id="max_postpone_time_for_failed_replicated_merges_ms">
  max\_postpone\_time\_for\_failed\_replicated\_merges\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "60000"},{"label": "Added new setting to enable postponing merge tasks in the replication queue."}]}]} />

The maximum postpone time for failed replicated merges.

<h2 id="max_postpone_time_for_failed_replicated_tasks_ms">
  max\_postpone\_time\_for\_failed\_replicated\_tasks\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "300000"},{"label": "Added new setting to enable postponing tasks in the replication queue."}]}]} />

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

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

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

The maximum number of merge tree projections.

<h2 id="max_replicated_fetches_network_bandwidth">
  max\_replicated\_fetches\_network\_bandwidth
</h2>

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

Limits the maximum speed of data exchange over the network in bytes per
second for [replicated](/reference/engines/table-engines/mergetree-family/replication)
fetches. This setting is applied to a particular table, unlike the
[`max_replicated_fetches_network_bandwidth_for_server`](/reference/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.

<h2 id="max_replicated_logs_to_keep">
  max\_replicated\_logs\_to\_keep
</h2>

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

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.

<h2 id="max_replicated_merges_in_queue">
  max\_replicated\_merges\_in\_queue
</h2>

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

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

<h2 id="max_replicated_merges_with_ttl_in_queue">
  max\_replicated\_merges\_with\_ttl\_in\_queue
</h2>

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

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

<h2 id="max_replicated_mutations_in_queue">
  max\_replicated\_mutations\_in\_queue
</h2>

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

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

<h2 id="max_replicated_sends_network_bandwidth">
  max\_replicated\_sends\_network\_bandwidth
</h2>

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

Limits the maximum speed of data exchange over the network in bytes per
second for [replicated](/reference/engines/table-engines/mergetree-family/replacingmergetree)
sends. This setting is applied to a particular table, unlike the
[`max_replicated_sends_network_bandwidth_for_server`](/reference/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.

<h2 id="max_suspicious_broken_parts">
  max\_suspicious\_broken\_parts
</h2>

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

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.

<h2 id="max_suspicious_broken_parts_bytes">
  max\_suspicious\_broken\_parts\_bytes
</h2>

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

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

Possible values:

* Any positive integer.

<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.

<h2 id="merge_max_block_size">
  merge\_max\_block\_size
</h2>

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

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.

<h2 id="merge_max_block_size_bytes">
  merge\_max\_block\_size\_bytes
</h2>

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

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

<h2 id="merge_max_bytes_to_prewarm_cache">
  merge\_max\_bytes\_to\_prewarm\_cache
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1073741824"},{"label": "Cloud sync"}]}]} />

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

<h2 id="merge_max_dynamic_subcolumns_in_compact_part">
  merge\_max\_dynamic\_subcolumns\_in\_compact\_part
</h2>

<SettingsInfoBlock type="UInt64Auto" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "auto"},{"label": "Add a new setting to limit number of dynamic subcolumns in Compact part after merge regardless the parameters specified in the data type"}]}]} />

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.

For example, if the table has a column with the JSON(max\_dynamic\_paths=1024) type and the setting merge\_max\_dynamic\_subcolumns\_in\_compact\_part is set to 128,
after merge into the Compact data part number of dynamic paths will be decreased to 128 in this part and only 128 paths will be written as dynamic subcolumns.

<h2 id="merge_max_dynamic_subcolumns_in_wide_part">
  merge\_max\_dynamic\_subcolumns\_in\_wide\_part
</h2>

<SettingsInfoBlock type="UInt64Auto" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "auto"},{"label": "Add a new setting to limit number of dynamic subcolumns in Wide part after merge regardless the parameters specified in the data type"}]}]} />

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

For example, if the table has a column with the JSON(max\_dynamic\_paths=1024) type and the setting merge\_max\_dynamic\_subcolumns\_in\_wide\_part is set to 128,
after merge into the Wide data part number of dynamic paths will be decreased to 128 in this part and only 128 paths will be written as dynamic subcolumns.

<h2 id="merge_selecting_sleep_ms">
  merge\_selecting\_sleep\_ms
</h2>

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

Minimum time to wait before trying to select parts to merge again after no
parts were selected. A lower setting will trigger selecting tasks in
background\_schedule\_pool frequently which result in large amount of requests
to zookeeper in large-scale clusters

<h2 id="merge_selecting_sleep_slowdown_factor">
  merge\_selecting\_sleep\_slowdown\_factor
</h2>

<SettingsInfoBlock type="Float" default_value="1.2" />

The sleep time for merge selecting task is multiplied by this factor when
there's nothing to merge and divided when a merge was assigned

<h2 id="merge_selector_algorithm">
  merge\_selector\_algorithm
</h2>

<SettingsInfoBlock type="MergeSelectorAlgorithm" default_value="Simple" />

The algorithm to select parts for merges assignment

<h2 id="merge_selector_base">
  merge\_selector\_base
</h2>

<SettingsInfoBlock type="Float" default_value="5" />

Affects write amplification of
assigned merges (expert level setting, don't change if you don't understand
what it is doing). Works for Simple and StochasticSimple merge selectors

<h2 id="merge_selector_blurry_base_scale_factor">
  merge\_selector\_blurry\_base\_scale\_factor
</h2>

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

Controls when the logic kicks in relatively to the number of parts in
partition. The bigger the factor the more belated reaction will be.

<h2 id="merge_selector_enable_heuristic_to_lower_max_parts_to_merge_at_once">
  merge\_selector\_enable\_heuristic\_to\_lower\_max\_parts\_to\_merge\_at\_once
</h2>

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

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

Enable heuristic for simple merge selector which will lower maximum limit for merge choice.
By doing so number of concurrent merges will increase which can help with TOO\_MANY\_PARTS
errors but at the same time this will increase the write amplification.

<h2 id="merge_selector_enable_heuristic_to_remove_small_parts_at_right">
  merge\_selector\_enable\_heuristic\_to\_remove\_small\_parts\_at\_right
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enable heuristic for selecting parts for merge which removes parts from right
side of range, if their size is less than specified ratio (0.01) of sum\_size.
Works for Simple and StochasticSimple merge selectors

<h2 id="merge_selector_heuristic_to_lower_max_parts_to_merge_at_once_exponent">
  merge\_selector\_heuristic\_to\_lower\_max\_parts\_to\_merge\_at\_once\_exponent
</h2>

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

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

Controls the exponent value used in formulae building lowering curve. Lowering exponent will
lower merge widths which will trigger increase in write amplification. The reverse is also true.

<h2 id="merge_selector_window_size">
  merge\_selector\_window\_size
</h2>

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

How many parts to look at once.

<h2 id="merge_total_max_bytes_to_prewarm_cache">
  merge\_total\_max\_bytes\_to\_prewarm\_cache
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "16106127360"},{"label": "Cloud sync"}]}]} />

Only available in ClickHouse Cloud. Maximal size of parts in total to prewarm
cache during merge.

<h2 id="merge_tree_clear_old_broken_detached_parts_ttl_timeout_seconds">
  merge\_tree\_clear\_old\_broken\_detached\_parts\_ttl\_timeout\_seconds
</h2>

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

Obsolete setting, does nothing.

<h2 id="merge_tree_clear_old_parts_interval_seconds">
  merge\_tree\_clear\_old\_parts\_interval\_seconds
</h2>

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

Sets the interval in seconds for ClickHouse to execute the cleanup of old
parts, WALs, and mutations.

Possible values:

* Any positive integer.

<h2 id="merge_tree_clear_old_temporary_directories_interval_seconds">
  merge\_tree\_clear\_old\_temporary\_directories\_interval\_seconds
</h2>

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

Sets the interval in seconds for ClickHouse to execute the cleanup of old
temporary directories.

Possible values:

* Any positive integer.

<h2 id="merge_tree_enable_clear_old_broken_detached">
  merge\_tree\_enable\_clear\_old\_broken\_detached
</h2>

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

Obsolete setting, does nothing.

<h2 id="merge_with_recompression_ttl_timeout">
  merge\_with\_recompression\_ttl\_timeout
</h2>

<SettingsInfoBlock type="Int64" default_value="14400" />

Minimum delay in seconds before repeating a merge with recompression TTL.

<h2 id="merge_with_ttl_timeout">
  merge\_with\_ttl\_timeout
</h2>

<SettingsInfoBlock type="Int64" default_value="14400" />

Minimum delay in seconds before repeating a merge with delete TTL.

<h2 id="merge_workload">
  merge\_workload
</h2>

Used to regulate how resources are utilized and shared between merges and
other workloads. Specified value is used as `workload` setting value for
background merges of this table. If not specified (empty string), then
server setting `merge_workload` is used instead.

**See Also**

* [Workload Scheduling](/concepts/features/configuration/server-config/workload-scheduling)

<h2 id="min_absolute_delay_to_close">
  min\_absolute\_delay\_to\_close
</h2>

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

Minimal absolute delay to close, stop serving requests and not
return Ok during status check.

<h2 id="min_age_to_force_merge_on_partition_only">
  min\_age\_to\_force\_merge\_on\_partition\_only
</h2>

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

Whether `min_age_to_force_merge_seconds` should be applied only on the entire
partition and not on subset.

By default, ignores setting `max_bytes_to_merge_at_max_space_in_pool` (see
`enable_max_bytes_limit_for_min_age_to_force_merge`).

Possible values:

* true, false

<h2 id="min_age_to_force_merge_seconds">
  min\_age\_to\_force\_merge\_seconds
</h2>

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

Merge parts if every part in the range is older than the value of
`min_age_to_force_merge_seconds`.

By default, ignores setting `max_bytes_to_merge_at_max_space_in_pool`
(see `enable_max_bytes_limit_for_min_age_to_force_merge`).

Possible values:

* Positive integer.

<h2 id="min_bytes_for_compact_part">
  min\_bytes\_for\_compact\_part
</h2>

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

Obsolete setting, does nothing.

<h2 id="min_bytes_for_full_part_storage">
  min\_bytes\_for\_full\_part\_storage
</h2>

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

Only available in ClickHouse Cloud. Minimal uncompressed size in bytes to
use full type of storage for data part instead of packed

<h2 id="min_bytes_for_wide_part">
  min\_bytes\_for\_wide\_part
</h2>

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

Minimum number of bytes/rows in a data part that can be stored in `Wide`
format. You can set one, both or none of these settings.

<h2 id="min_bytes_to_prewarm_caches">
  min\_bytes\_to\_prewarm\_caches
</h2>

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

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

Minimal size (uncompressed bytes) to prewarm mark cache and primary index cache
for new parts

<h2 id="min_bytes_to_rebalance_partition_over_jbod">
  min\_bytes\_to\_rebalance\_partition\_over\_jbod
</h2>

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

Sets minimal amount of bytes to enable balancing when distributing new big
parts over volume disks [JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures).

Possible values:

* Positive integer.
* `0` — Balancing is disabled.

**Usage**

The value of the `min_bytes_to_rebalance_partition_over_jbod` setting should
not be less than the value of the
[max\_bytes\_to\_merge\_at\_max\_space\_in\_pool](/reference/settings/merge-tree-settings#max_bytes_to_merge_at_max_space_in_pool)
/ 1024. Otherwise, ClickHouse throws an exception.

<h2 id="min_columns_to_activate_adaptive_write_buffer">
  min\_columns\_to\_activate\_adaptive\_write\_buffer
</h2>

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

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

Allow to reduce memory usage for tables with lots of columns by using adaptive writer buffers.

Possible values:

* 0 - unlimited
* 1 - always enabled

<h2 id="min_compress_block_size">
  min\_compress\_block\_size
</h2>

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

Minimum size of blocks of uncompressed data required for compression when
writing the next mark. You can also specify this setting in the global settings
(see [min\_compress\_block\_size](/reference/settings/merge-tree-settings#min_compress_block_size)
setting). The value specified when the table is created overrides the global value
for this setting.

<h2 id="min_compressed_bytes_to_fsync_after_fetch">
  min\_compressed\_bytes\_to\_fsync\_after\_fetch
</h2>

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

Minimal number of compressed bytes to do fsync for part after fetch (0 - disabled)

<h2 id="min_compressed_bytes_to_fsync_after_merge">
  min\_compressed\_bytes\_to\_fsync\_after\_merge
</h2>

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

Minimal number of compressed bytes to do fsync for part after merge (0 - disabled)

<h2 id="min_delay_to_insert_ms">
  min\_delay\_to\_insert\_ms
</h2>

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

Min delay of inserting data into MergeTree table in milliseconds, if there
are a lot of unmerged parts in single partition.

<h2 id="min_delay_to_mutate_ms">
  min\_delay\_to\_mutate\_ms
</h2>

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

Min delay of mutating MergeTree table in milliseconds, if there are a lot of
unfinished mutations

<h2 id="min_free_disk_bytes_to_perform_insert">
  min\_free\_disk\_bytes\_to\_perform\_insert
</h2>

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

The minimum number of bytes that should be free in disk space in order to
insert data. If the number of available free bytes is less than
`min_free_disk_bytes_to_perform_insert` then an exception is thrown and the
insert is not executed. Note that this setting:

* takes into account the `keep_free_space_bytes` setting.
* does not take into account the amount of data that will be written by the
  `INSERT` operation.
* is only checked if a positive (non-zero) number of bytes is specified

Possible values:

* Any positive integer.

<Note>
  If both `min_free_disk_bytes_to_perform_insert` and `min_free_disk_ratio_to_perform_insert`
  are specified, ClickHouse will count on the value that will allow to perform
  inserts on a bigger amount of free memory.
</Note>

<h2 id="min_free_disk_ratio_to_perform_insert">
  min\_free\_disk\_ratio\_to\_perform\_insert
</h2>

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

The minimum free to total disk space ratio to perform an `INSERT`. Must be a
floating point value between 0 and 1. Note that this setting:

* takes into account the `keep_free_space_bytes` setting.
* does not take into account the amount of data that will be written by the
  `INSERT` operation.
* is only checked if a positive (non-zero) ratio is specified

Possible values:

* Float, 0.0 - 1.0

Note that if both `min_free_disk_ratio_to_perform_insert` and
`min_free_disk_bytes_to_perform_insert` are specified, ClickHouse will count
on the value that will allow to perform inserts on a bigger amount of free
memory.

<h2 id="min_index_granularity_bytes">
  min\_index\_granularity\_bytes
</h2>

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

Min allowed size of data granules in bytes.

To provide a safeguard against accidentally creating tables with very low
`index_granularity_bytes`.

<h2 id="min_level_for_full_part_storage">
  min\_level\_for\_full\_part\_storage
</h2>

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

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

Only available in ClickHouse Cloud. Minimal part level to
use full type of storage for data part instead of packed

<h2 id="min_level_for_wide_part">
  min\_level\_for\_wide\_part
</h2>

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

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

Minimal part level to create a data part in `Wide` format instead of `Compact`.

<h2 id="min_marks_to_honor_max_concurrent_queries">
  min\_marks\_to\_honor\_max\_concurrent\_queries
</h2>

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

The minimal number of marks read by the query for applying the [max\_concurrent\_queries](#max_concurrent_queries)
setting.

<Note>
  Queries will still be limited by other `max_concurrent_queries` settings.
</Note>

Possible values:

* Positive integer.
* `0` — Disabled (`max_concurrent_queries` limit applied to no queries).

**Example**

```xml theme={null}
<min_marks_to_honor_max_concurrent_queries>10</min_marks_to_honor_max_concurrent_queries>
```

<h2 id="min_merge_bytes_to_use_direct_io">
  min\_merge\_bytes\_to\_use\_direct\_io
</h2>

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

The minimum data volume for merge operation that is required for using direct
I/O access to the storage disk. When merging data parts, ClickHouse calculates
the total storage volume of all the data to be merged. If the volume exceeds
`min_merge_bytes_to_use_direct_io` bytes, ClickHouse reads and writes the
data to the storage disk using the direct I/O interface (`O_DIRECT` option).
If `min_merge_bytes_to_use_direct_io = 0`, then direct I/O is disabled.

<h2 id="min_parts_to_merge_at_once">
  min\_parts\_to\_merge\_at\_once
</h2>

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

Minimal amount of data parts which merge selector can pick to merge at once
(expert level setting, don't change if you don't understand what it is doing).
0 - disabled. Works for Simple and StochasticSimple merge selectors.

<h2 id="min_relative_delay_to_close">
  min\_relative\_delay\_to\_close
</h2>

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

Minimal delay from other replicas to close, stop serving
requests and not return Ok during status check.

<h2 id="min_relative_delay_to_measure">
  min\_relative\_delay\_to\_measure
</h2>

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

Calculate relative replica delay only if absolute delay is not less that
this value.

<h2 id="min_relative_delay_to_yield_leadership">
  min\_relative\_delay\_to\_yield\_leadership
</h2>

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

Obsolete setting, does nothing.

<h2 id="min_replicated_logs_to_keep">
  min\_replicated\_logs\_to\_keep
</h2>

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

Keep about this number of last records in ZooKeeper log, even if they are
obsolete. It doesn't affect work of tables: used only to diagnose ZooKeeper
log before cleaning.

Possible values:

* Any positive integer.

<h2 id="min_rows_for_compact_part">
  min\_rows\_for\_compact\_part
</h2>

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

Obsolete setting, does nothing.

<h2 id="min_rows_for_full_part_storage">
  min\_rows\_for\_full\_part\_storage
</h2>

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

Only available in ClickHouse Cloud. Minimal number of rows to use full type
of storage for data part instead of packed

<h2 id="min_rows_for_wide_part">
  min\_rows\_for\_wide\_part
</h2>

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

Minimal number of rows to create a data part in `Wide` format instead of `Compact`.

<h2 id="min_rows_to_fsync_after_merge">
  min\_rows\_to\_fsync\_after\_merge
</h2>

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

Minimal number of rows to do fsync for part after merge (0 - disabled)

<h2 id="mutation_workload">
  mutation\_workload
</h2>

Used to regulate how resources are utilized and shared between mutations and
other workloads. Specified value is used as `workload` setting value for
background mutations of this table. If not specified (empty string), then
server setting `mutation_workload` is used instead.

**See Also**

* [Workload Scheduling](/concepts/features/configuration/server-config/workload-scheduling)

<h2 id="non_replicated_deduplication_window">
  non\_replicated\_deduplication\_window
</h2>

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

The number of the most recently inserted blocks in the non-replicated
[MergeTree](/reference/engines/table-engines/mergetree-family/mergetree) table
for which hash sums are stored to check for duplicates.

Possible values:

* Any positive integer.
* `0` (disable deduplication).

A deduplication mechanism is used, similar to replicated tables (see
[replicated\_deduplication\_window](#replicated_deduplication_window) setting).
The hash sums of the created parts are written to a local file on a disk.

<h2 id="notify_newest_block_number">
  notify\_newest\_block\_number
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "0"},{"label": "Cloud sync"}]}]} />

Notify newest block number to SharedJoin or SharedSet. Only in ClickHouse Cloud.

<h2 id="nullable_serialization_version">
  nullable\_serialization\_version
</h2>

<SettingsInfoBlock type="MergeTreeNullableSerializationVersion" default_value="basic" />

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

Controls the serialization method used for `Nullable(T)` columns.

Possible values:

* basic — Use the standard serialization for `Nullable(T)`.

* allow\_sparse — Permit `Nullable(T)` to use sparse encoding.

<h2 id="number_of_free_entries_in_pool_to_execute_mutation">
  number\_of\_free\_entries\_in\_pool\_to\_execute\_mutation
</h2>

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

When there is less than specified number of free entries in pool, do not
execute part mutations. This is to leave free threads for regular merges and
to avoid "Too many parts" errors.

Possible values:

* Any positive integer.

**Usage**

The value of the `number_of_free_entries_in_pool_to_execute_mutation` setting
should be less than the value of the [background\_pool\_size](/reference/settings/server-settings/settings#background_pool_size)

* [background\_merges\_mutations\_concurrency\_ratio](/reference/settings/server-settings/settings#background_merges_mutations_concurrency_ratio).
  Otherwise, ClickHouse will throw an exception.

<h2 id="number_of_free_entries_in_pool_to_execute_optimize_entire_partition">
  number\_of\_free\_entries\_in\_pool\_to\_execute\_optimize\_entire\_partition
</h2>

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

When there is less than specified number of free entries in pool, do not
execute optimizing entire partition in the background (this task generated
when set `min_age_to_force_merge_seconds` and enable
`min_age_to_force_merge_on_partition_only`). This is to leave free threads
for regular merges and avoid "Too many parts".

Possible values:

* Positive integer.

The value of the `number_of_free_entries_in_pool_to_execute_optimize_entire_partition`
setting should be less than the value of the
[background\_pool\_size](/reference/settings/server-settings/settings#background_pool_size)

* [background\_merges\_mutations\_concurrency\_ratio](/reference/settings/server-settings/settings#background_merges_mutations_concurrency_ratio).
  Otherwise, ClickHouse throws an exception.

<h2 id="number_of_free_entries_in_pool_to_lower_max_size_of_merge">
  number\_of\_free\_entries\_in\_pool\_to\_lower\_max\_size\_of\_merge
</h2>

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

When there is less than the specified number of free entries in pool
(or replicated queue), start to lower maximum size of merge to process
(or to put in queue).
This is to allow small merges to process - not filling the pool with long
running merges.

Possible values:

* Any positive integer.

<h2 id="number_of_mutations_to_delay">
  number\_of\_mutations\_to\_delay
</h2>

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

If table has at least
that many unfinished mutations, artificially slow down mutations of table.
Disabled if set to 0

<h2 id="number_of_mutations_to_throw">
  number\_of\_mutations\_to\_throw
</h2>

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

If table has at least that many unfinished mutations, throw 'Too many mutations'
exception. Disabled if set to 0

<h2 id="number_of_partitions_to_consider_for_merge">
  number\_of\_partitions\_to\_consider\_for\_merge
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "10"},{"label": "Cloud sync"}]}]} />

Only available in ClickHouse Cloud. Up to top N partitions which we will
consider for merge. Partitions picked in a random weighted way where weight
is amount of data parts which can be merged in this partition.

<h2 id="object_serialization_version">
  object\_serialization\_version
</h2>

<SettingsInfoBlock type="MergeTreeObjectSerializationVersion" default_value="v3" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "v2"},{"label": "Add a setting to control JSON serialization versions"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "v3"},{"label": "Enable v3 serialization version for JSON by default to use advanced shared data serialization"}]}]} />

Serialization version for JSON data type. Required for compatibility.

Possible values:

* `v1`
* `v2`
* `v3`

Only version `v3` supports changing the shared data serialization version.

<h2 id="object_shared_data_buckets_for_compact_part">
  object\_shared\_data\_buckets\_for\_compact\_part
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "8"},{"label": "Add a setting to control number of buckets for shared data in JSON serialization in compact parts"}]}]} />

The number of buckets for JSON shared data serialization in Compact parts. Works with `map_with_buckets` and `advanced` shared data serializations.
The maximum allowed value is 256.

<h2 id="object_shared_data_buckets_for_wide_part">
  object\_shared\_data\_buckets\_for\_wide\_part
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "32"},{"label": "Add a setting to control number of buckets for shared data in JSON serialization in wide parts"}]}]} />

The number of buckets for JSON shared data serialization in Wide parts. Works with `map_with_buckets` and `advanced` shared data serializations.
The maximum allowed value is 256.

<h2 id="object_shared_data_serialization_version">
  object\_shared\_data\_serialization\_version
</h2>

<SettingsInfoBlock type="MergeTreeObjectSharedDataSerializationVersion" default_value="advanced" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "map"},{"label": "Add a setting to control JSON serialization versions"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "advanced"},{"label": "Enable advanced shared data serialization version by default"}]}]} />

Serialization version for shared data inside JSON data type.

Possible values:

* `map` - store shared data as `Map(String, String)`
* `map_with_buckets` - store shared data as several separate `Map(String, String)` columns. Using buckets improves reading individual paths from shared data.
* `advanced` - special serialization of shared data designed to significantly improve reading of individual paths from shared data.
  Note that this serialization increases the shared data storage size on disk because we store a lot of additional information.

The number of buckets for `map_with_buckets` and `advanced` serializations is determined by settings
[object\_shared\_data\_buckets\_for\_compact\_part](#object_shared_data_buckets_for_compact_part)/[object\_shared\_data\_buckets\_for\_wide\_part](#object_shared_data_buckets_for_wide_part).

<h2 id="object_shared_data_serialization_version_for_zero_level_parts">
  object\_shared\_data\_serialization\_version\_for\_zero\_level\_parts
</h2>

<SettingsInfoBlock type="MergeTreeObjectSharedDataSerializationVersion" default_value="map_with_buckets" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "map"},{"label": "Add a setting to control JSON serialization versions  for zero level parts"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "map_with_buckets"},{"label": "Enable map_with_buckets shared data serialization version for zero level parts by default"}]}]} />

This setting allows to specify different serialization version of the
shared data inside JSON type for zero level parts that are created during inserts.
It's recommended not to use `advanced` shared data serialization for zero level parts because it can increase
the insertion time significantly.

<h2 id="old_parts_lifetime">
  old\_parts\_lifetime
</h2>

<SettingsInfoBlock type="Seconds" default_value="480" />

The time (in seconds) of storing inactive parts to protect against data loss
during spontaneous server reboots.

Possible values:

* Any positive integer.

After merging several parts into a new part, ClickHouse marks the original
parts as inactive and deletes them only after `old_parts_lifetime` seconds.
Inactive parts are removed if they are not used by current queries, i.e. if
the `refcount` of the part is 1.

`fsync` is not called for new parts, so for some time new parts exist only
in the server's RAM (OS cache). If the server is rebooted spontaneously, new
parts can be lost or damaged. To protect data inactive parts are not deleted
immediately.

During startup ClickHouse checks the integrity of the parts. If the merged
part is damaged ClickHouse returns the inactive parts to the active list,
and later merges them again. Then the damaged part is renamed (the `broken_`
prefix is added) and moved to the `detached` folder. If the merged part is
not damaged, then the original inactive parts are renamed (the `ignored_`
prefix is added) and moved to the `detached` folder.

The default `dirty_expire_centisecs` value (a Linux kernel setting) is 30
seconds (the maximum time that written data is stored only in RAM), but under
heavy loads on the disk system data can be written much later. Experimentally,
a value of 480 seconds was chosen for `old_parts_lifetime`, during which a
new part is guaranteed to be written to disk.

<h2 id="optimize_row_order">
  optimize\_row\_order
</h2>

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

Controls if the row order should be optimized during inserts to improve the
compressability of the newly inserted table part.

Only has an effect for ordinary MergeTree-engine tables. Does nothing for
specialized MergeTree engine tables (e.g. CollapsingMergeTree).

MergeTree tables are (optionally) compressed using [compression codecs](/reference/statements/create/table#column_compression_codec).
Generic compression codecs such as LZ4 and ZSTD achieve maximum compression
rates if the data exposes patterns. Long runs of the same value typically
compress very well.

If this setting is enabled, ClickHouse attempts to store the data in newly
inserted parts in a row order that minimizes the number of equal-value runs
across the columns of the new table part.
In other words, a small number of equal-value runs mean that individual runs
are long and compress well.

Finding the optimal row order is computationally infeasible (NP hard).
Therefore, ClickHouse uses a heuristics to quickly find a row order which
still improves compression rates over the original row order.

<details markdown="1">
  <summary>Heuristics for finding a row order</summary>

  It is generally possible to shuffle the rows of a table (or table part)
  freely as SQL considers the same table (table part) in different row order
  equivalent.

  This freedom of shuffling rows is restricted when a primary key is defined
  for the table. In ClickHouse, a primary key `C1, C2, ..., CN` enforces that
  the table rows are sorted by columns `C1`, `C2`, ... `Cn` ([clustered index](https://en.wikipedia.org/wiki/Database_index#Clustered)).
  As a result, rows can only be shuffled within "equivalence classes" of row,
  i.e. rows which have the same values in their primary key columns.
  The intuition is that primary keys with high-cardinality, e.g. primary keys
  involving a `DateTime64` timestamp column, lead to many small equivalence
  classes. Likewise, tables with a low-cardinality primary key, create few and
  large equivalence classes. A table with no primary key represents the extreme
  case of a single equivalence class which spans all rows.

  The fewer and the larger the equivalence classes are, the higher the degree
  of freedom when re-shuffling rows.

  The heuristics applied to find the best row order within each equivalence
  class is suggested by D. Lemire, O. Kaser in
  [Reordering columns for smaller indexes](https://doi.org/10.1016/j.ins.2011.02.002)
  and based on sorting the rows within each equivalence class by ascending
  cardinality of the non-primary key columns.

  It performs three steps:

  1. Find all equivalence classes based on the row values in primary key columns.
  2. For each equivalence class, calculate (usually estimate) the cardinalities
     of the non-primary-key columns.
  3. For each equivalence class, sort the rows in order of ascending
     non-primary-key column cardinality.
</details>

If enabled, insert operations incur additional CPU costs to analyze and
optimize the row order of the new data. INSERTs are expected to take 30-50%
longer depending on the data characteristics.
Compression rates of LZ4 or ZSTD improve on average by 20-40%.

This setting works best for tables with no primary key or a low-cardinality
primary key, i.e. a table with only few distinct primary key values.
High-cardinality primary keys, e.g. involving timestamp columns of type
`DateTime64`, are not expected to benefit from this setting.

<h2 id="part_minmax_index_columns">
  part\_minmax\_index\_columns
</h2>

<SettingsInfoBlock type="MergeTreePartMinMaxIndexColumns" default_value="partition_key_only" />

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

Selects which columns the per-part min-max index covers. Each value enables an additional group of columns on top of the previous one.

Possible values:

* `partition_key_only` — only the partition-key columns are tracked.
* `with_block_number_offset` — partition-key columns plus the persisted `_block_number` and `_block_offset` virtual columns. Enables part-level pruning by these columns.

<h2 id="part_moves_between_shards_delay_seconds">
  part\_moves\_between\_shards\_delay\_seconds
</h2>

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

Time to wait before/after moving parts between shards.

<h2 id="part_moves_between_shards_enable">
  part\_moves\_between\_shards\_enable
</h2>

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

Experimental/Incomplete feature to move parts between shards. Does not take
into account sharding expressions.

<h2 id="parts_to_delay_insert">
  parts\_to\_delay\_insert
</h2>

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

If the number of active parts in a single partition exceeds the
`parts_to_delay_insert` value, an `INSERT` is artificially slowed down.

Possible values:

* Any positive integer.

ClickHouse artificially executes `INSERT` longer (adds 'sleep') so that the
background merge process can merge parts faster than they are added.

<h2 id="parts_to_throw_insert">
  parts\_to\_throw\_insert
</h2>

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

If the number of active parts in a single partition exceeds the
`parts_to_throw_insert` value, `INSERT` is interrupted with the `Too many
parts (N). Merges are processing significantly slower than inserts`
exception.

Possible values:

* Any positive integer.

To achieve maximum performance of `SELECT` queries, it is necessary to
minimize the number of parts processed, see [Merge Tree](/resources/develop-contribute/introduction/architecture#merge-tree).

Prior to version 23.6 this setting was set to 300. You can set a higher
different value, it will reduce the probability of the `Too many parts`
error, but at the same time `SELECT` performance might degrade. Also in case
of a merge issue (for example, due to insufficient disk space) you will
notice it later than you would with the original 300.

<h2 id="prefer_fetch_merged_part_size_threshold">
  prefer\_fetch\_merged\_part\_size\_threshold
</h2>

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

If the sum of the size of parts exceeds this threshold and the time since a
replication log entry creation is greater than
`prefer_fetch_merged_part_time_threshold`, then prefer fetching merged part
from a replica instead of doing merge locally. This is to speed up very long
merges.

Possible values:

* Any positive integer.

<h2 id="prefer_fetch_merged_part_time_threshold">
  prefer\_fetch\_merged\_part\_time\_threshold
</h2>

<SettingsInfoBlock type="Seconds" default_value="3600" />

If the time passed since a replication log (ClickHouse Keeper or ZooKeeper)
entry creation exceeds this threshold, and the sum of the size of parts is
greater than `prefer_fetch_merged_part_size_threshold`, then prefer fetching
merged part from a replica instead of doing merge locally. This is to speed
up very long merges.

Possible values:

* Any positive integer.

<h2 id="prewarm_mark_cache">
  prewarm\_mark\_cache
</h2>

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

If true mark cache will be
prewarmed by saving marks to mark cache on inserts, merges, fetches and on
startup of server

<h2 id="prewarm_primary_key_cache">
  prewarm\_primary\_key\_cache
</h2>

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

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

If true primary index
cache will be prewarmed by saving marks to mark cache on inserts, merges,
fetches and on startup of server

<h2 id="primary_key_compress_block_size">
  primary\_key\_compress\_block\_size
</h2>

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

Primary compress block size, the actual size of the block to compress.

<h2 id="primary_key_compression_codec">
  primary\_key\_compression\_codec
</h2>

<SettingsInfoBlock type="String" default_value="ZSTD(3)" />

Compression encoding used by primary, primary key is small enough and cached,
so the default compression is ZSTD(3).

<h2 id="primary_key_lazy_load">
  primary\_key\_lazy\_load
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Load primary key in memory on
first use instead of on table initialization. This can save memory in the
presence of a large number of tables.

<h2 id="primary_key_ratio_of_unique_prefix_values_to_skip_suffix_columns">
  primary\_key\_ratio\_of\_unique\_prefix\_values\_to\_skip\_suffix\_columns
</h2>

<SettingsInfoBlock type="Float" default_value="0.9" />

If the value of a column of the primary key in data part changes at least in
this ratio of times, skip loading next columns in memory. This allows to save
memory usage by not loading useless columns of the primary key.

<h2 id="propagate_types_serialization_versions_to_nested_types">
  propagate\_types\_serialization\_versions\_to\_nested\_types
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "1"},{"label": "Propagate data types serialization version to nested types by default"}]}]} />

If true, serialization versions like string\_serialization\_version will be propagated inside nested types like Array/Map/Nullable/JSON/etc. If disabled, the serialization version will take affect only to top-level columns of this type and Tuple el

<h2 id="ratio_of_defaults_for_sparse_serialization">
  ratio\_of\_defaults\_for\_sparse\_serialization
</h2>

<SettingsInfoBlock type="Float" default_value="0.9375" />

Minimal ratio of the number of *default* values to the number of *all* values
in a column. Setting this value causes the column to be stored using sparse
serializations.

If a column is sparse (contains mostly zeros), ClickHouse can encode it in
a sparse format and automatically optimize calculations - the data does not
require full decompression during queries. To enable this sparse
serialization, define the `ratio_of_defaults_for_sparse_serialization`
setting to be less than 1.0. If the value is greater than or equal to 1.0,
then the columns will be always written using the normal full serialization.

Possible values:

* Float between `0` and `1` to enable sparse serialization
* `1.0` (or greater) if you do not want to use sparse serialization

**Example**

Notice the `s` column in the following table is an empty string for 95% of
the rows. In `my_regular_table` we do not use sparse serialization, and in
`my_sparse_table` we set `ratio_of_defaults_for_sparse_serialization` to
0.95:

```sql theme={null}
CREATE TABLE my_regular_table
(
`id` UInt64,
`s` String
)
ENGINE = MergeTree
ORDER BY id;

INSERT INTO my_regular_table
SELECT
number AS id,
number % 20 = 0 ? toString(number): '' AS s
FROM
numbers(10000000);

CREATE TABLE my_sparse_table
(
`id` UInt64,
`s` String
)
ENGINE = MergeTree
ORDER BY id
SETTINGS ratio_of_defaults_for_sparse_serialization = 0.95;

INSERT INTO my_sparse_table
SELECT
number,
number % 20 = 0 ? toString(number): ''
FROM
numbers(10000000);
```

Notice the `s` column in `my_sparse_table` uses less storage space on disk:

```sql theme={null}
SELECT table, name, data_compressed_bytes, data_uncompressed_bytes FROM system.columns
WHERE table LIKE 'my_%_table';
```

```response theme={null}
┌─table────────────┬─name─┬─data_compressed_bytes─┬─data_uncompressed_bytes─┐
│ my_regular_table │ id   │              37790741 │                75488328 │
│ my_regular_table │ s    │               2451377 │                12683106 │
│ my_sparse_table  │ id   │              37790741 │                75488328 │
│ my_sparse_table  │ s    │               2283454 │                 9855751 │
└──────────────────┴──────┴───────────────────────┴─────────────────────────┘
```

You can verify if a column is using the sparse encoding by viewing the
`serialization_kind` column of the `system.parts_columns` table:

```sql theme={null}
SELECT column, serialization_kind FROM system.parts_columns
WHERE table LIKE 'my_sparse_table';
```

You can see which parts of `s` were stored using the sparse serialization:

```response theme={null}
┌─column─┬─serialization_kind─┐
│ id     │ Default            │
│ s      │ Default            │
│ id     │ Default            │
│ s      │ Default            │
│ id     │ Default            │
│ s      │ Sparse             │
│ id     │ Default            │
│ s      │ Sparse             │
│ id     │ Default            │
│ s      │ Sparse             │
│ id     │ Default            │
│ s      │ Sparse             │
│ id     │ Default            │
│ s      │ Sparse             │
│ id     │ Default            │
│ s      │ Sparse             │
│ id     │ Default            │
│ s      │ Sparse             │
│ id     │ Default            │
│ s      │ Sparse             │
│ id     │ Default            │
│ s      │ Sparse             │
└────────┴────────────────────┘
```

<h2 id="reduce_blocking_parts_sleep_ms">
  reduce\_blocking\_parts\_sleep\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "5000"},{"label": "Cloud sync"}]}]} />

Only available in ClickHouse Cloud. Minimum time to wait before trying to
reduce blocking parts again after no ranges were dropped/replaced. A lower
setting will trigger tasks in background\_schedule\_pool frequently which
results in large amount of requests to zookeeper in large-scale clusters

<h2 id="refresh_parts_interval">
  refresh\_parts\_interval
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "0"},{"label": "A new setting"}]}]} />

If it is greater than zero - refresh the list of data parts from the underlying filesystem to check if the data was updated under the hood.
It can be set only if the table is located on readonly disks (which means that this is a readonly replica, while data is being written by another replica).

<h2 id="refresh_statistics_interval">
  refresh\_statistics\_interval
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "300"},{"label": "Enable statistics cache"}]}, {"id": "row-2","items": [{"label": "25.11"},{"label": "0"},{"label": "New setting"}]}]} />

The interval of refreshing statistics cache in seconds. If it is set to zero, the refreshing will be disabled.

<h2 id="remote_fs_execute_merges_on_single_replica_time_threshold">
  remote\_fs\_execute\_merges\_on\_single\_replica\_time\_threshold
</h2>

<SettingsInfoBlock type="Seconds" default_value="10800" />

When this setting has a value greater than zero only a single replica starts
the merge immediately if merged part on shared storage.

<Note>
  Zero-copy replication is not ready for production
  Zero-copy replication is disabled by default in ClickHouse version 22.8 and
  higher.

  This feature is not recommended for production use.
</Note>

Possible values:

* Any positive integer.

<h2 id="remote_fs_zero_copy_path_compatible_mode">
  remote\_fs\_zero\_copy\_path\_compatible\_mode
</h2>

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

Run zero-copy in compatible mode during conversion process.

<h2 id="remote_fs_zero_copy_zookeeper_path">
  remote\_fs\_zero\_copy\_zookeeper\_path
</h2>

<SettingsInfoBlock type="String" default_value="/clickhouse/zero_copy" />

ZooKeeper path for zero-copy table-independent info.

<h2 id="remove_empty_parts">
  remove\_empty\_parts
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Remove empty parts after they were pruned by TTL, mutation, or collapsing
merge algorithm.

<h2 id="remove_rolled_back_parts_immediately">
  remove\_rolled\_back\_parts\_immediately
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Setting for an incomplete experimental feature.

<h2 id="remove_unused_patch_parts">
  remove\_unused\_patch\_parts
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

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

Remove in background patch parts which are applied for all active parts.

<h2 id="replace_long_file_name_to_hash">
  replace\_long\_file\_name\_to\_hash
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

If the file name for column is too long (more than 'max\_file\_name\_length'
bytes) replace it to SipHash128

<h2 id="replicated_can_become_leader">
  replicated\_can\_become\_leader
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

If true, replicated tables replicas on this node will try to acquire
leadership.

Possible values:

* `true`
* `false`

<h2 id="replicated_deduplication_window">
  replicated\_deduplication\_window
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "10000"},{"label": "increase default value"}]}]} />

The number of most recently inserted blocks for which ClickHouse Keeper stores
hash sums to check for duplicates.

Possible values:

* Any positive integer.
* 0 (disable deduplication)

The `Insert` command creates one or more blocks (parts). For
[insert deduplication](/reference/engines/table-engines/mergetree-family/replication),
when writing into replicated tables, ClickHouse writes the hash sums of the
created parts into ClickHouse Keeper. Hash sums are stored only for the most
recent `replicated_deduplication_window` blocks. The oldest hash sums are
removed from ClickHouse Keeper.

A large number for `replicated_deduplication_window` slows down `Inserts`
because more entries need to be compared. The hash sum is calculated from
the composition of the field names and types and the data of the inserted
part (stream of bytes).

<h2 id="replicated_deduplication_window_for_async_inserts">
  replicated\_deduplication\_window\_for\_async\_inserts
</h2>

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

The number of most recently async inserted blocks for which ClickHouse Keeper
stores hash sums to check for duplicates.

Possible values:

* Any positive integer.
* 0 (disable deduplication for async\_inserts)

The [Async Insert](/reference/settings/session-settings#async_insert) command will
be cached in one or more blocks (parts). For [insert deduplication](/reference/engines/table-engines/mergetree-family/replication),
when writing into replicated tables, ClickHouse writes the hash sums of each
insert into ClickHouse Keeper. Hash sums are stored only for the most recent
`replicated_deduplication_window_for_async_inserts` blocks. The oldest hash
sums are removed from ClickHouse Keeper.
A large number of `replicated_deduplication_window_for_async_inserts` slows
down `Async Inserts` because it needs to compare more entries.
The hash sum is calculated from the composition of the field names and types
and the data of the insert (stream of bytes).

<h2 id="replicated_deduplication_window_seconds">
  replicated\_deduplication\_window\_seconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "3600"},{"label": "decrease default value"}]}]} />

The number of seconds after which the hash sums of the inserted blocks are
removed from ClickHouse Keeper.

Possible values:

* Any positive integer.

Similar to [replicated\_deduplication\_window](#replicated_deduplication_window),
`replicated_deduplication_window_seconds` specifies how long to store hash
sums of blocks for insert deduplication. Hash sums older than
`replicated_deduplication_window_seconds` are removed from ClickHouse Keeper,
even if they are less than ` replicated_deduplication_window`.

The time is relative to the time of the most recent record, not to the wall
time. If it's the only record it will be stored forever.

<h2 id="replicated_deduplication_window_seconds_for_async_inserts">
  replicated\_deduplication\_window\_seconds\_for\_async\_inserts
</h2>

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

The number of seconds after which the hash sums of the async inserts are
removed from ClickHouse Keeper.

Possible values:

* Any positive integer.

Similar to [replicated\_deduplication\_window\_for\_async\_inserts](#replicated_deduplication_window_for_async_inserts),
`replicated_deduplication_window_seconds_for_async_inserts` specifies how
long to store hash sums of blocks for async insert deduplication. Hash sums
older than `replicated_deduplication_window_seconds_for_async_inserts` are
removed from ClickHouse Keeper, even if they are less than
`replicated_deduplication_window_for_async_inserts`.

The time is relative to the time of the most recent record, not to the wall
time. If it's the only record it will be stored forever.

<h2 id="replicated_fetches_http_connection_timeout">
  replicated\_fetches\_http\_connection\_timeout
</h2>

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

Obsolete setting, does nothing.

<h2 id="replicated_fetches_http_receive_timeout">
  replicated\_fetches\_http\_receive\_timeout
</h2>

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

Obsolete setting, does nothing.

<h2 id="replicated_fetches_http_send_timeout">
  replicated\_fetches\_http\_send\_timeout
</h2>

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

Obsolete setting, does nothing.

<h2 id="replicated_fetches_min_part_level">
  replicated\_fetches\_min\_part\_level
</h2>

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

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

Minimum part level to fetch from other replicas. Parts with level below this threshold are postponed
(kept in the replication queue and re-evaluated each scheduling cycle, not permanently skipped).
Use 1 to postpone fetching level-0 (unmerged) parts, reducing replication overhead during heavy ingestion.
Default: 0 (fetch all parts regardless of level).

<h2 id="replicated_fetches_min_part_level_timeout_seconds">
  replicated\_fetches\_min\_part\_level\_timeout\_seconds
</h2>

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

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

Timeout in seconds after which a part below replicated\_fetches\_min\_part\_level will be fetched anyway.
Use 0 to disable the timeout (parts below the minimum level are postponed indefinitely until merged).
Default: 300 (force fetch after 5 minutes).

<h2 id="replicated_max_mutations_in_one_entry">
  replicated\_max\_mutations\_in\_one\_entry
</h2>

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

Max number of mutation commands that can be merged together and executed in
one MUTATE\_PART entry (0 means unlimited)

<h2 id="replicated_max_parallel_fetches">
  replicated\_max\_parallel\_fetches
</h2>

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

Obsolete setting, does nothing.

<h2 id="replicated_max_parallel_fetches_for_host">
  replicated\_max\_parallel\_fetches\_for\_host
</h2>

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

Obsolete setting, does nothing.

<h2 id="replicated_max_parallel_fetches_for_table">
  replicated\_max\_parallel\_fetches\_for\_table
</h2>

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

Obsolete setting, does nothing.

<h2 id="replicated_max_parallel_sends">
  replicated\_max\_parallel\_sends
</h2>

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

Obsolete setting, does nothing.

<h2 id="replicated_max_parallel_sends_for_table">
  replicated\_max\_parallel\_sends\_for\_table
</h2>

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

Obsolete setting, does nothing.

<h2 id="replicated_max_ratio_of_wrong_parts">
  replicated\_max\_ratio\_of\_wrong\_parts
</h2>

<SettingsInfoBlock type="Float" default_value="0.5" />

If the ratio of wrong parts to total number of parts is less than this -
allow to start.

Possible values:

* Float, 0.0 - 1.0

<h2 id="search_orphaned_parts_disks">
  search\_orphaned\_parts\_disks
</h2>

<SettingsInfoBlock type="SearchOrphanedPartsDisks" default_value="any" />

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

ClickHouse scans all disks for orphaned parts upon any ATTACH or CREATE table
in order to not allow to miss data parts at undefined (not included in policy) disks.
Orphaned parts originates from potentially unsafe storage reconfiguration, e.g. if a disk was excluded from storage policy.
This setting limits scope of disks to search by traits of the disks.

Possible values:

* any - scope is not limited.
* local - scope is limited by local disks .
* none - empty scope, do not search

<h2 id="serialization_info_version">
  serialization\_info\_version
</h2>

<SettingsInfoBlock type="MergeTreeSerializationInfoVersion" default_value="with_types" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "with_types"},{"label": "Change to the newer format allowing custom string serialization"}]}, {"id": "row-2","items": [{"label": "25.10"},{"label": "basic"},{"label": "New setting"}]}]} />

Serialization info version used when writing `serialization.json`.
This setting is required for compatibility during cluster upgrades.

Possible values:

* `basic` - Basic format.
* `with_types` - Format with additional `types_serialization_versions` field, allowing per-type serialization versions.
  This makes settings like `string_serialization_version` effective.

During rolling upgrades, set this to `basic` so that new servers produce
data parts compatible with old servers. After the upgrade completes,
switch to `WITH_TYPES` to enable per-type serialization versions.

<h2 id="share_nested_offsets">
  share\_nested\_offsets
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1"},{"label": "When set to false, Array columns with dotted names that share a common prefix are treated as independent columns instead of sharing offset files as part of legacy Nested semantics"}]}]} />

When enabled (default), Array columns with dotted names that share a common prefix (e.g. n.a and n.b)
are treated as part of a Nested structure: they share a single offsets file on disk (e.g. n.size0),
and their array sizes are validated to be equal during INSERT.
When disabled, each Array column gets its own independent offset file, dotted names carry no special
semantics, and a scalar column may coexist with dotted Array columns sharing the same prefix
(e.g. n UInt32 alongside n.a Array(String)). This setting is immutable after table creation.

<h2 id="shared_merge_tree_activate_coordinated_merges_tasks">
  shared\_merge\_tree\_activate\_coordinated\_merges\_tasks
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "0"},{"label": "New settings"}]}, {"id": "row-2","items": [{"label": "25.8"},{"label": "0"},{"label": "New settings"}]}, {"id": "row-3","items": [{"label": "25.7"},{"label": "0"},{"label": "New settings"}]}, {"id": "row-4","items": [{"label": "25.6"},{"label": "0"},{"label": "New settings"}]}, {"id": "row-5","items": [{"label": "25.10"},{"label": "0"},{"label": "New settings"}]}]} />

Activates rescheduling of coordinated merges tasks. It can be useful even when
shared\_merge\_tree\_enable\_coordinated\_merges=0 because this will populate merge coordinator
statistics and help with cold start.

<h2 id="shared_merge_tree_create_per_replica_metadata_nodes">
  shared\_merge\_tree\_create\_per\_replica\_metadata\_nodes
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "0"},{"label": "Reduce the amount of metadata in Keeper."}]}, {"id": "row-2","items": [{"label": "25.1"},{"label": "1"},{"label": "Cloud sync"}]}]} />

Enables creation of per-replica /metadata and /columns nodes in ZooKeeper.
Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_disable_merges_and_mutations_assignment">
  shared\_merge\_tree\_disable\_merges\_and\_mutations\_assignment
</h2>

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

Stop merges assignment for shared merge tree. Only available in ClickHouse
Cloud

<h2 id="shared_merge_tree_empty_partition_lifetime">
  shared\_merge\_tree\_empty\_partition\_lifetime
</h2>

<SettingsInfoBlock type="Seconds" default_value="86400" />

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

How many seconds partition will be stored in keeper if it has no parts.

<h2 id="shared_merge_tree_enable_automatic_empty_partitions_cleanup">
  shared\_merge\_tree\_enable\_automatic\_empty\_partitions\_cleanup
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "Enable by default"}]}, {"id": "row-2","items": [{"label": "25.9"},{"label": "0"},{"label": "New setting"}]}]} />

Enabled cleanup of Keeper entries of empty partition.

<h2 id="shared_merge_tree_enable_coordinated_merges">
  shared\_merge\_tree\_enable\_coordinated\_merges
</h2>

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

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

Enables coordinated merges strategy

<h2 id="shared_merge_tree_enable_keeper_parts_extra_data">
  shared\_merge\_tree\_enable\_keeper\_parts\_extra\_data
</h2>

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

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

Enables writing attributes into virtual parts and committing blocks in keeper

<h2 id="shared_merge_tree_enable_outdated_parts_check">
  shared\_merge\_tree\_enable\_outdated\_parts\_check
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "Cloud sync"}]}]} />

Enable outdated parts check. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_idle_parts_update_seconds">
  shared\_merge\_tree\_idle\_parts\_update\_seconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "3600"},{"label": "Cloud sync"}]}]} />

Interval in seconds for parts update without being triggered by ZooKeeper
watch in the shared merge tree. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_initial_parts_update_backoff_ms">
  shared\_merge\_tree\_initial\_parts\_update\_backoff\_ms
</h2>

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

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

Initial backoff for parts update. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_interserver_http_connection_timeout_ms">
  shared\_merge\_tree\_interserver\_http\_connection\_timeout\_ms
</h2>

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

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

Timeouts for interserver HTTP connection. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_interserver_http_timeout_ms">
  shared\_merge\_tree\_interserver\_http\_timeout\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "10000"},{"label": "Cloud sync"}]}]} />

Timeouts for interserver HTTP communication. Only available in ClickHouse
Cloud

<h2 id="shared_merge_tree_leader_update_period_random_add_seconds">
  shared\_merge\_tree\_leader\_update\_period\_random\_add\_seconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "10"},{"label": "Cloud sync"}]}]} />

Add uniformly distributed value from 0 to x seconds to
shared\_merge\_tree\_leader\_update\_period to avoid thundering
herd effect. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_leader_update_period_seconds">
  shared\_merge\_tree\_leader\_update\_period\_seconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "30"},{"label": "Cloud sync"}]}]} />

Maximum period to recheck leadership for parts update. Only available in
ClickHouse Cloud

<h2 id="shared_merge_tree_max_outdated_parts_to_process_at_once">
  shared\_merge\_tree\_max\_outdated\_parts\_to\_process\_at\_once
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1000"},{"label": "Cloud sync"}]}]} />

Maximum amount of outdated parts leader will try to confirm for removal at
one HTTP request. Only available in ClickHouse Cloud.

<h2 id="shared_merge_tree_max_parts_update_backoff_ms">
  shared\_merge\_tree\_max\_parts\_update\_backoff\_ms
</h2>

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

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

Max backoff for parts update. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_max_parts_update_leaders_in_total">
  shared\_merge\_tree\_max\_parts\_update\_leaders\_in\_total
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "6"},{"label": "Cloud sync"}]}]} />

Maximum number of parts update leaders. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_max_parts_update_leaders_per_az">
  shared\_merge\_tree\_max\_parts\_update\_leaders\_per\_az
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "2"},{"label": "Cloud sync"}]}]} />

Maximum number of parts update leaders. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_max_replicas_for_parts_deletion">
  shared\_merge\_tree\_max\_replicas\_for\_parts\_deletion
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "10"},{"label": "Cloud sync"}]}]} />

Max replicas which will participate in parts deletion (killer thread). Only
available in ClickHouse Cloud

<h2 id="shared_merge_tree_max_replicas_to_merge_parts_for_each_parts_range">
  shared\_merge\_tree\_max\_replicas\_to\_merge\_parts\_for\_each\_parts\_range
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "5"},{"label": "Cloud sync"}]}]} />

Max replicas which will try to assign potentially conflicting merges (allow
to avoid redundant conflicts in merges assignment). 0 means disabled. Only
available in ClickHouse Cloud

<h2 id="shared_merge_tree_max_suspicious_broken_parts">
  shared\_merge\_tree\_max\_suspicious\_broken\_parts
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "0"},{"label": "Max broken parts for SMT, if more - deny automatic detach"}]}]} />

Max broken parts for SMT, if more - deny automatic detach.

<h2 id="shared_merge_tree_max_suspicious_broken_parts_bytes">
  shared\_merge\_tree\_max\_suspicious\_broken\_parts\_bytes
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "0"},{"label": "Max size of all broken parts for SMT, if more - deny automatic detach"}]}]} />

Max size of all broken parts for SMT, if more - deny automatic detach.

<h2 id="shared_merge_tree_memo_ids_remove_timeout_seconds">
  shared\_merge\_tree\_memo\_ids\_remove\_timeout\_seconds
</h2>

<SettingsInfoBlock type="Int64" default_value="1800" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1800"},{"label": "Cloud sync"}]}]} />

How long we store insert memoization ids to avoid wrong actions during
insert retries. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_merge_coordinator_election_check_period_ms">
  shared\_merge\_tree\_merge\_coordinator\_election\_check\_period\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="30000" />

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

Time between runs of merge coordinator election thread

<h2 id="shared_merge_tree_merge_coordinator_factor">
  shared\_merge\_tree\_merge\_coordinator\_factor
</h2>

<SettingsInfoBlock type="Float" default_value="1.1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "1.100000023841858"},{"label": "New setting"}]}, {"id": "row-2","items": [{"label": "25.10"},{"label": "1.100000023841858"},{"label": "Lower coordinator sleep time after load"}]}]} />

Time changing factor for delay of coordinator thread

<h2 id="shared_merge_tree_merge_coordinator_fetch_fresh_metadata_period_ms">
  shared\_merge\_tree\_merge\_coordinator\_fetch\_fresh\_metadata\_period\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="10000" />

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

How often merge coordinator should sync with zookeeper to take fresh metadata

<h2 id="shared_merge_tree_merge_coordinator_max_merge_request_size">
  shared\_merge\_tree\_merge\_coordinator\_max\_merge\_request\_size
</h2>

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

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

Number of merges that coordinator can request from MergerMutator at once

<h2 id="shared_merge_tree_merge_coordinator_max_period_ms">
  shared\_merge\_tree\_merge\_coordinator\_max\_period\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="10000" />

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

Maximum time between runs of merge coordinator thread

<h2 id="shared_merge_tree_merge_coordinator_merges_prepare_count">
  shared\_merge\_tree\_merge\_coordinator\_merges\_prepare\_count
</h2>

<SettingsInfoBlock type="UInt64Auto" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "auto"},{"label": "Make setting auto: max merge tasks per replica * number of active replicas"}]}, {"id": "row-2","items": [{"label": "25.5"},{"label": "100"},{"label": "New setting"}]}]} />

Number of merge entries that coordinator should prepare and distribute across workers.
When set to 'auto', equals the max number of merge tasks allowed on a single replica multiplied by the number of active replicas.

<h2 id="shared_merge_tree_merge_coordinator_min_period_ms">
  shared\_merge\_tree\_merge\_coordinator\_min\_period\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="1" />

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

Minimum time between runs of merge coordinator thread

<h2 id="shared_merge_tree_merge_worker_fast_timeout_ms">
  shared\_merge\_tree\_merge\_worker\_fast\_timeout\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="100" />

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

Timeout that merge worker thread will use if it is needed to update it's state after immediate action

<h2 id="shared_merge_tree_merge_worker_regular_timeout_ms">
  shared\_merge\_tree\_merge\_worker\_regular\_timeout\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="10000" />

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

Time between runs of merge worker thread

<h2 id="shared_merge_tree_outdated_parts_group_size">
  shared\_merge\_tree\_outdated\_parts\_group\_size
</h2>

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

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

How many replicas will be in the same rendezvous hash group for outdated parts cleanup.
Only available in ClickHouse Cloud.

<h2 id="shared_merge_tree_partitions_hint_ratio_to_reload_merge_pred_for_mutations">
  shared\_merge\_tree\_partitions\_hint\_ratio\_to\_reload\_merge\_pred\_for\_mutations
</h2>

<SettingsInfoBlock type="Float" default_value="0.5" />

Will reload merge predicate in merge/mutate selecting task when `<candidate
partitions for mutations only (partitions that cannot be merged)>/<candidate
partitions for mutations>` ratio is higher than the setting. Only available
in ClickHouse Cloud

<h2 id="shared_merge_tree_parts_load_batch_size">
  shared\_merge\_tree\_parts\_load\_batch\_size
</h2>

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

Amount of fetch parts metadata jobs to schedule at once. Only available in
ClickHouse Cloud

<h2 id="shared_merge_tree_postpone_next_merge_for_locally_merged_parts_ms">
  shared\_merge\_tree\_postpone\_next\_merge\_for\_locally\_merged\_parts\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "0"},{"label": "Cloud sync"}]}]} />

Time to keep a locally merged part without starting a new merge containing
this part. Gives other replicas a chance fetch the part and start this merge.
Only available in ClickHouse Cloud.

<h2 id="shared_merge_tree_postpone_next_merge_for_locally_merged_parts_rows_threshold">
  shared\_merge\_tree\_postpone\_next\_merge\_for\_locally\_merged\_parts\_rows\_threshold
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1000000"},{"label": "Cloud sync"}]}]} />

Minimum size of part (in rows) to postpone assigning a next merge just after
merging it locally. Only available in ClickHouse Cloud.

<h2 id="shared_merge_tree_range_for_merge_window_size">
  shared\_merge\_tree\_range\_for\_merge\_window\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "10"},{"label": "Cloud sync"}]}]} />

Time to keep a locally merged part without starting a new merge containing
this part. Gives other replicas a chance fetch the part and start this merge.
Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_read_virtual_parts_from_leader">
  shared\_merge\_tree\_read\_virtual\_parts\_from\_leader
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "Cloud sync"}]}]} />

Read virtual parts from leader when possible. Only available in ClickHouse
Cloud

<h2 id="shared_merge_tree_replica_set_max_lifetime_seconds">
  shared\_merge\_tree\_replica\_set\_max\_lifetime\_seconds
</h2>

<SettingsInfoBlock type="Seconds" default_value="1800" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1800"},{"label": "Increase default replica set background update interval to 30 minutes"}]}, {"id": "row-2","items": [{"label": "26.2"},{"label": "300"},{"label": "New setting"}]}]} />

How often replicas will try to update replica set in background. Next run is jittered
uniformly in \[0, value] seconds. Exception: value = 0 does not follow that contract;
the implementation applies a minimum of 200 ms, so the next run is jittered in \[0, 200] ms.

<h2 id="shared_merge_tree_try_fetch_part_in_memory_data_from_replicas">
  shared\_merge\_tree\_try\_fetch\_part\_in\_memory\_data\_from\_replicas
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "0"},{"label": "New setting to fetch parts data from other replicas"}]}]} />

If enabled all the replicas try to fetch part in memory data (like primary
key, partition info and so on) from other replicas where it already exists.

<h2 id="shared_merge_tree_update_replica_flags_delay_ms">
  shared\_merge\_tree\_update\_replica\_flags\_delay\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="30000" />

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

How often replica will try to reload it's flags according to background schedule.

<h2 id="shared_merge_tree_use_metadata_hints_cache">
  shared\_merge\_tree\_use\_metadata\_hints\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "Cloud sync"}]}]} />

Enables requesting FS cache hints from in-memory
cache on other replicas. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_use_outdated_parts_compact_format">
  shared\_merge\_tree\_use\_outdated\_parts\_compact\_format
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "1"},{"label": "Enable outdated parts v3 by default"}]}, {"id": "row-2","items": [{"label": "25.1"},{"label": "0"},{"label": "Cloud sync"}]}]} />

Use compact format for outdated parts: reduces load to Keeper, improves
outdated parts processing. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_use_too_many_parts_count_from_virtual_parts">
  shared\_merge\_tree\_use\_too\_many\_parts\_count\_from\_virtual\_parts
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "0"},{"label": "Cloud sync"}]}]} />

If enabled too many parts counter will rely on shared data in Keeper, not on
local replica state. Only available in ClickHouse Cloud

<h2 id="shared_merge_tree_use_zookeeper_connection_pool">
  shared\_merge\_tree\_use\_zookeeper\_connection\_pool
</h2>

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

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

If enabled, SharedMergeTree uses one of server-level pooled ZooKeeper sessions.

<h2 id="shared_merge_tree_virtual_parts_discovery_batch">
  shared\_merge\_tree\_virtual\_parts\_discovery\_batch
</h2>

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

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

How many partition discoveries should be packed into batch

<h2 id="simultaneous_parts_removal_limit">
  simultaneous\_parts\_removal\_limit
</h2>

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

If there are a lot of outdated parts cleanup thread will try to delete up to
`simultaneous_parts_removal_limit` parts during one iteration.
`simultaneous_parts_removal_limit` set to `0` means unlimited.

<h2 id="sleep_before_commit_local_part_in_replicated_table_ms">
  sleep\_before\_commit\_local\_part\_in\_replicated\_table\_ms
</h2>

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

For testing. Do not change it.

<h2 id="sleep_before_loading_outdated_parts_ms">
  sleep\_before\_loading\_outdated\_parts\_ms
</h2>

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

For testing. Do not change it.

<h2 id="storage_policy">
  storage\_policy
</h2>

<SettingsInfoBlock type="String" default_value="default" />

Name of storage disk policy

<h2 id="string_serialization_version">
  string\_serialization\_version
</h2>

<SettingsInfoBlock type="MergeTreeStringSerializationVersion" default_value="with_size_stream" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "with_size_stream"},{"label": "Change to the newer format with separate sizes"}]}, {"id": "row-2","items": [{"label": "25.10"},{"label": "single_stream"},{"label": "New setting"}]}]} />

Controls the serialization format for top-level `String` columns.

This setting is only effective when `serialization_info_version` is set to "with\_types".
When set to `with_size_stream`, top-level `String` columns are serialized with a separate
`.size` subcolumn storing string lengths, rather than inline. This allows real `.size`
subcolumns and can improve compression efficiency.

Nested `String` types (e.g., inside `Nullable`, `LowCardinality`, `Array`, or `Map`)
are not affected, except when they appear in a `Tuple`.

Possible values:

* `single_stream` — Use the standard serialization format with inline sizes.
* `with_size_stream` — Use a separate size stream for top-level `String` columns.

<h2 id="table_disk">
  table\_disk
</h2>

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

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

This is table disk, the path/endpoint should point to the table data, not to
the database data. Can be set only for s3\_plain/s3\_plain\_rewritable/web.

<h2 id="table_readonly">
  table\_readonly
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "New setting to mark table as read-only, preventing inserts and modifications"}]}]} />

If set to true, the table is in read-only mode. Any attempts to insert data or modify the table will fail.

<h2 id="temporary_directories_lifetime">
  temporary\_directories\_lifetime
</h2>

<SettingsInfoBlock type="Seconds" default_value="86400" />

How many seconds to keep tmp\_-directories. You should not lower this value
because merges and mutations may not be able to work with low value of this
setting.

<h2 id="try_fetch_recompressed_part_timeout">
  try\_fetch\_recompressed\_part\_timeout
</h2>

<SettingsInfoBlock type="Seconds" default_value="7200" />

Timeout (in seconds) before starting merge with recompression. During this
time ClickHouse tries to fetch recompressed part from replica which assigned
this merge with recompression.

Recompression works slow in most cases, so we don't start merge with
recompression until this timeout and trying to fetch recompressed part from
replica which assigned this merge with recompression.

Possible values:

* Any positive integer.

<h2 id="ttl_only_drop_parts">
  ttl\_only\_drop\_parts
</h2>

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

Controls whether data parts are fully dropped in MergeTree tables when all
rows in that part have expired according to their `TTL` settings.

When `ttl_only_drop_parts` is disabled (by default), only the rows that have
expired based on their TTL settings are removed.

When `ttl_only_drop_parts` is enabled, the entire part is dropped if all
rows in that part have expired according to their `TTL` settings.

<h2 id="use_adaptive_write_buffer_for_dynamic_subcolumns">
  use\_adaptive\_write\_buffer\_for\_dynamic\_subcolumns
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Allow to use adaptive writer buffers during writing dynamic subcolumns to
reduce memory usage

<h2 id="use_async_block_ids_cache">
  use\_async\_block\_ids\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

If true, we cache the hash sums of the async inserts.

Possible values:

* `true`
* `false`

A block bearing multiple async inserts will generate multiple hash sums.
When some of the inserts are duplicated, keeper will only return one
duplicated hash sum in one RPC, which will cause unnecessary RPC retries.
This cache will watch the hash sums path in Keeper. If updates are watched
in the Keeper, the cache will update as soon as possible, so that we are
able to filter the duplicated inserts in the memory.

<h2 id="use_compact_variant_discriminators_serialization">
  use\_compact\_variant\_discriminators\_serialization
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enables compact mode for binary serialization of discriminators in Variant
data type.
This mode allows to use significantly less memory for storing discriminators
in parts when there is mostly one variant or a lot of NULL values.

<h2 id="use_const_adaptive_granularity">
  use\_const\_adaptive\_granularity
</h2>

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

Always use constant granularity for whole part. It allows to compress in
memory values of index granularity. It can be useful in extremely large
workloads with thin tables.

<h2 id="use_metadata_cache">
  use\_metadata\_cache
</h2>

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

Obsolete setting, does nothing.

<h2 id="use_minimalistic_checksums_in_zookeeper">
  use\_minimalistic\_checksums\_in\_zookeeper
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Use small format (dozens bytes) for part checksums in ZooKeeper instead of
ordinary ones (dozens KB). Before enabling check that all replicas support
new format.

<h2 id="use_minimalistic_part_header_in_zookeeper">
  use\_minimalistic\_part\_header\_in\_zookeeper
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Storage method of the data parts headers in ZooKeeper. If enabled, ZooKeeper
stores less data. For details, see [here](/reference/settings/server-settings/settings#use_minimalistic_part_header_in_zookeeper).

<h2 id="use_primary_key_cache">
  use\_primary\_key\_cache
</h2>

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

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

Use cache for primary index
instead of saving all indexes in memory. Can be useful for very large tables

<h2 id="vertical_merge_algorithm_min_bytes_to_activate">
  vertical\_merge\_algorithm\_min\_bytes\_to\_activate
</h2>

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

Minimal (approximate) uncompressed size in bytes in merging parts to activate
Vertical merge algorithm.

<h2 id="vertical_merge_algorithm_min_columns_to_activate">
  vertical\_merge\_algorithm\_min\_columns\_to\_activate
</h2>

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

Minimal amount of non-PK columns to activate Vertical merge algorithm.

<h2 id="vertical_merge_algorithm_min_rows_to_activate">
  vertical\_merge\_algorithm\_min\_rows\_to\_activate
</h2>

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

Minimal (approximate) sum of rows in
merging parts to activate Vertical merge algorithm.

<h2 id="vertical_merge_optimize_lightweight_delete">
  vertical\_merge\_optimize\_lightweight\_delete
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

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

If true, lightweight delete is optimized on vertical merge.

<h2 id="vertical_merge_optimize_ttl_delete">
  vertical\_merge\_optimize\_ttl\_delete
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "1"},{"label": "Allow vertical merge algorithm for merges that need to remove rows expired by TTL"}]}]} />

If true, rows TTL delete is optimized on vertical merge. Instead of forcing horizontal merge,
the TTL filter is evaluated and passed to the merging algorithm which sets skip flags in row sources.

<h2 id="vertical_merge_remote_filesystem_prefetch">
  vertical\_merge\_remote\_filesystem\_prefetch
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

If true prefetching of data from remote filesystem is used for the next
column during merge

<h2 id="wait_for_unique_parts_send_before_shutdown_ms">
  wait\_for\_unique\_parts\_send\_before\_shutdown\_ms
</h2>

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

Before shutdown table will wait for required amount time for unique parts
(exist only on current replica) to be fetched by other replicas (0 means
disabled).

<h2 id="write_ahead_log_bytes_to_fsync">
  write\_ahead\_log\_bytes\_to\_fsync
</h2>

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

Obsolete setting, does nothing.

<h2 id="write_ahead_log_interval_ms_to_fsync">
  write\_ahead\_log\_interval\_ms\_to\_fsync
</h2>

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

Obsolete setting, does nothing.

<h2 id="write_ahead_log_max_bytes">
  write\_ahead\_log\_max\_bytes
</h2>

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

Obsolete setting, does nothing.

<h2 id="write_final_mark">
  write\_final\_mark
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Obsolete setting, does nothing.

<h2 id="write_marks_for_substreams_in_compact_parts">
  write\_marks\_for\_substreams\_in\_compact\_parts
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "Enable writing marks for substreams in compact parts by default"}]}, {"id": "row-2","items": [{"label": "25.5"},{"label": "0"},{"label": "New setting"}]}]} />

Enables writing marks per each substream instead of per each column in Compact parts.
It allows to read individual subcolumns from the data part efficiently.

For example, column `t Tuple(a String, b UInt32, c Array(Nullable(UInt32)))` is serialized in the next substreams:

* `t.a` for String data of tuple element `a`
* `t.b` for UInt32 data of tuple element `b`
* `t.c.size0` for array sizes of tuple element `c`
* `t.c.null` for null map of nested array elements of tuple element `c`
* `t.c` for UInt32 data pf nested array elements of tuple element `c`

When this setting is enabled, we will write a mark for each of these 5 substreams, which means that we will be able to read
the data of each individual substream from the granule separately if needed. For example, if we want to read the subcolumn `t.c` we will read only data of
substreams `t.c.size0`, `t.c.null` and `t.c` and won't read data from substreams `t.a` and `t.b`. When this setting is disabled,
we will write a mark only for top-level column `t`, which means that we will always read the whole column data from the granule, even if we need only data of some substreams.

<h2 id="zero_copy_concurrent_part_removal_max_postpone_ratio">
  zero\_copy\_concurrent\_part\_removal\_max\_postpone\_ratio
</h2>

<SettingsInfoBlock type="Float" default_value="0.05" />

Max percentage of top level parts to postpone removal in order to get
smaller independent ranges. Recommended not to change.

<h2 id="zero_copy_concurrent_part_removal_max_split_times">
  zero\_copy\_concurrent\_part\_removal\_max\_split\_times
</h2>

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

Max recursion depth for splitting independent Outdated parts ranges into
smaller subranges. Recommended not to change.

<h2 id="zero_copy_merge_mutation_min_parts_size_sleep_before_lock">
  zero\_copy\_merge\_mutation\_min\_parts\_size\_sleep\_before\_lock
</h2>

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

If zero copy replication is enabled sleep random amount of time before trying
to lock depending on parts size for merge or mutation

<h2 id="zero_copy_merge_mutation_min_parts_size_sleep_no_scale_before_lock">
  zero\_copy\_merge\_mutation\_min\_parts\_size\_sleep\_no\_scale\_before\_lock
</h2>

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

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

If zero copy replication is enabled sleep random amount of time up to 500ms
before trying to lock for merge or mutation.

<h2 id="zookeeper_session_expiration_check_period">
  zookeeper\_session\_expiration\_check\_period
</h2>

<SettingsInfoBlock type="Seconds" default_value="60" />

ZooKeeper session expiration check period, in seconds.

Possible values:

* Any positive integer.
