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

# merge_tree_* session settings

> ClickHouse session settings in the merge_tree_* generated group.

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

export const CloudOnlyBadge = () => {
  return <div className="cloudBadge">
            <div className="cloudIcon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path fillRule="evenodd" clipRule="evenodd" d="M5.33395 12.6667H12.3739C13.6593 12.6667 14.7073 11.6187 14.7073 10.3334C14.7073 9.04804 13.6593 8.00004 12.3739 8.00004H12.0839V7.33337C12.0839 5.12671 10.2906 3.33337 8.08395 3.33337C6.09928 3.33337 4.45395 4.78537 4.14195 6.68204C2.55728 6.76271 1.29395 8.06204 1.29395 9.66671C1.29395 11.3234 2.63728 12.6667 4.29395 12.6667H5.33395Z" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
            </svg>
        </div>
            {'ClickHouse Cloud only'}
        </div>;
};

These settings are available in [system.settings](/docs/reference/system-tables/settings) and are autogenerated from [source](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp).

<h2 id="merge_tree_coarse_index_granularity">
  merge\_tree\_coarse\_index\_granularity
</h2>

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

When searching for data, ClickHouse checks the data marks in the index file. If ClickHouse finds that required keys are in some range, it divides this range into `merge_tree_coarse_index_granularity` subranges and searches the required keys there recursively.

Possible values:

* Any positive even integer.

<h2 id="merge_tree_compact_parts_min_granules_to_multibuffer_read">
  merge\_tree\_compact\_parts\_min\_granules\_to\_multibuffer\_read
</h2>

<CloudOnlyBadge />

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

Only has an effect in ClickHouse Cloud. Number of granules in stripe of compact part of MergeTree tables to use multibuffer reader, which supports parallel reading and prefetch. In case of reading from remote fs using of multibuffer reader increases number of read request. A part is read with a single buffer when it contains both fewer granules than this threshold and fewer granules than the number of columns being read, because in that case the single buffer reader issues fewer read requests than the multibuffer reader.

<h2 id="merge_tree_determine_task_size_by_prewhere_columns">
  merge\_tree\_determine\_task\_size\_by\_prewhere\_columns
</h2>

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

Whether to use only prewhere columns size to determine reading task size.

<h2 id="merge_tree_generic_exclusion_search_max_steps">
  merge\_tree\_generic\_exclusion\_search\_max\_steps
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "0"},{"label": "New setting to limit the number of steps of the generic exclusion search over the primary key index."}]}]} />

When a filter cannot be evaluated as a single continuous range of the primary key, for example when it uses key columns other than the first one, ClickHouse runs an iterative generic exclusion search algorithm over the index marks. The same algorithm is used for the analysis of the text index. This setting limits the number of steps (index checks) the algorithm spends on each data part.

The budget is spent on the largest remaining mark ranges first. When it is exhausted, the ranges that were not fully analyzed are accepted as a whole, so the query stays correct but may read more granules than an unlimited search would select. A lower budget speeds up index analysis at the cost of reading more data. The limit is approximate rather than a strict cap on the analysis cost: the search can exceed it by roughly one round of splitting, and when the part is already divided into many ranges (for example, by the query condition cache), each of them is checked at least once regardless of the limit.

The number of steps the search made for each data part is reported in the trace level log messages of the query, and the `IndexGenericExclusionSearchStepLimitReached` and `TextIndexGenericExclusionSearchStepLimitReached` profile events count how many times the budget was exhausted.

The (default) value 0 means unlimited steps.

Possible values:

* 0 for unlimited steps, or any positive integer.

<h2 id="merge_tree_max_bytes_to_use_cache">
  merge\_tree\_max\_bytes\_to\_use\_cache
</h2>

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

If ClickHouse should read more than `merge_tree_max_bytes_to_use_cache` bytes in one query, it does not use the cache of uncompressed blocks.

The cache of uncompressed blocks stores data extracted for queries. ClickHouse uses this cache to speed up responses to repeated small queries. This setting protects the cache from trashing by queries that read a large amount of data. The [uncompressed\_cache\_size](/docs/reference/settings/server-settings/settings#uncompressed_cache_size) server setting defines the size of the cache of uncompressed blocks.

Possible values:

* Any positive integer.

<h2 id="merge_tree_max_rows_to_use_cache">
  merge\_tree\_max\_rows\_to\_use\_cache
</h2>

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

If ClickHouse should read more than `merge_tree_max_rows_to_use_cache` rows in one query, it does not use the cache of uncompressed blocks.

The cache of uncompressed blocks stores data extracted for queries. ClickHouse uses this cache to speed up responses to repeated small queries. This setting protects the cache from trashing by queries that read a large amount of data. The [uncompressed\_cache\_size](/docs/reference/settings/server-settings/settings#uncompressed_cache_size) server setting defines the size of the cache of uncompressed blocks.

Possible values:

* Any positive integer.

<h2 id="merge_tree_min_bytes_for_concurrent_read">
  merge\_tree\_min\_bytes\_for\_concurrent\_read
</h2>

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

If the number of bytes to read from one file of a [MergeTree](/docs/reference/engines/table-engines/mergetree-family/mergetree)-engine table exceeds `merge_tree_min_bytes_for_concurrent_read`, then ClickHouse tries to concurrently read from this file in several threads.

Possible value:

* Positive integer.

<h2 id="merge_tree_min_bytes_for_concurrent_read_for_remote_filesystem">
  merge\_tree\_min\_bytes\_for\_concurrent\_read\_for\_remote\_filesystem
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "0"},{"label": "Setting is deprecated"}]}]} />

The minimum number of bytes to read from one file before [MergeTree](/docs/reference/engines/table-engines/mergetree-family/mergetree) engine can parallelize reading, when reading from remote filesystem. We do not recommend using this setting.

Possible values:

* Positive integer.

<h2 id="merge_tree_min_bytes_for_seek">
  merge\_tree\_min\_bytes\_for\_seek
</h2>

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

If the distance between two data blocks to be read in one file is less than `merge_tree_min_bytes_for_seek` bytes, then ClickHouse sequentially reads a range of file that contains both blocks, thus avoiding extra seek.

Possible values:

* Any positive integer.

<h2 id="merge_tree_min_bytes_per_task_for_remote_reading">
  merge\_tree\_min\_bytes\_per\_task\_for\_remote\_reading
</h2>

**Aliases**: `filesystem_prefetch_min_bytes_for_single_read_task`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "2097152"},{"label": "Value is unified with `filesystem_prefetch_min_bytes_for_single_read_task`"}]}]} />

Min bytes to read per task.

<h2 id="merge_tree_min_read_task_size">
  merge\_tree\_min\_read\_task\_size
</h2>

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

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

Hard lower limit on the task size (even when the number of granules is low and the number of available threads is high we won't allocate smaller tasks

<h2 id="merge_tree_min_rows_for_concurrent_read">
  merge\_tree\_min\_rows\_for\_concurrent\_read
</h2>

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

If the number of rows to be read from a file of a [MergeTree](/docs/reference/engines/table-engines/mergetree-family/mergetree) table exceeds `merge_tree_min_rows_for_concurrent_read` then ClickHouse tries to perform a concurrent reading from this file on several threads.

Possible values:

* Positive integer.

<h2 id="merge_tree_min_rows_for_concurrent_read_for_remote_filesystem">
  merge\_tree\_min\_rows\_for\_concurrent\_read\_for\_remote\_filesystem
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "0"},{"label": "Setting is deprecated"}]}]} />

The minimum number of lines to read from one file before the [MergeTree](/docs/reference/engines/table-engines/mergetree-family/mergetree) engine can parallelize reading, when reading from remote filesystem. We do not recommend using this setting.

Possible values:

* Positive integer.

<h2 id="merge_tree_min_rows_for_seek">
  merge\_tree\_min\_rows\_for\_seek
</h2>

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

If the distance between two data blocks to be read in one file is less than `merge_tree_min_rows_for_seek` rows, then ClickHouse does not seek through the file but reads the data sequentially.

Possible values:

* Any positive integer.

<h2 id="merge_tree_read_split_ranges_into_intersecting_and_non_intersecting_injection_probability">
  merge\_tree\_read\_split\_ranges\_into\_intersecting\_and\_non\_intersecting\_injection\_probability
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "For testing of `PartsSplitter` - split read ranges into intersecting and non intersecting every time you read from MergeTree with the specified probability."}]}]} />

For testing of `PartsSplitter` - split read ranges into intersecting and non intersecting every time you read from MergeTree with the specified probability.

<h2 id="merge_tree_storage_snapshot_sleep_ms">
  merge\_tree\_storage\_snapshot\_sleep\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "0"},{"label": "A new setting to debug storage snapshot consistency in query"}]}]} />

Inject artificial delay (in milliseconds) when creating a storage snapshot for MergeTree tables.
Used for testing and debugging purposes only.

Possible values:

* 0 - No delay (default)
* N - Delay in milliseconds

<h2 id="merge_tree_use_const_size_tasks_for_remote_reading">
  merge\_tree\_use\_const\_size\_tasks\_for\_remote\_reading
</h2>

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

Whether to use constant size tasks for reading from a remote table.

<h2 id="merge_tree_use_deserialization_prefixes_cache">
  merge\_tree\_use\_deserialization\_prefixes\_cache
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "1"},{"label": "A new setting to control the usage of deserialization prefixes cache in MergeTree"}]}]} />

Enables caching of columns metadata from the file prefixes during reading from remote disks in MergeTree.

<h2 id="merge_tree_use_prefixes_deserialization_thread_pool">
  merge\_tree\_use\_prefixes\_deserialization\_thread\_pool
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "1"},{"label": "A new setting controlling the usage of the thread pool for parallel prefixes deserialization in MergeTree"}]}]} />

Enables usage of the thread pool for parallel prefixes reading in Wide parts in MergeTree. Size of that thread pool is controlled by server setting `max_prefixes_deserialization_thread_pool_size`.

<h2 id="merge_tree_use_v1_object_and_dynamic_serialization">
  merge\_tree\_use\_v1\_object\_and\_dynamic\_serialization
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "0"},{"label": "Add new serialization V2 version for JSON and Dynamic types"}]}]} />

When enabled, V1 serialization version of JSON and Dynamic types will be used in MergeTree instead of V2. Changing this setting takes affect only after server restart.
