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

# Session Settings

> Settings which are found in the ``system.settings`` table.

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 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>;
};

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>;
};

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

<h2 id="add_http_cors_header">
  add\_http\_cors\_header
</h2>

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

Write add http CORS header.

<h2 id="additional_result_filter">
  additional\_result\_filter
</h2>

An additional filter expression to apply to the result of `SELECT` query.
This setting is not applied to any subquery.

**Example**

```sql theme={null}
INSERT INTO table_1 VALUES (1, 'a'), (2, 'bb'), (3, 'ccc'), (4, 'dddd');
SElECT * FROM table_1;
```

```response theme={null}
┌─x─┬─y────┐
│ 1 │ a    │
│ 2 │ bb   │
│ 3 │ ccc  │
│ 4 │ dddd │
└───┴──────┘
```

```sql theme={null}
SELECT *
FROM table_1
SETTINGS additional_result_filter = 'x != 2'
```

```response theme={null}
┌─x─┬─y────┐
│ 1 │ a    │
│ 3 │ ccc  │
│ 4 │ dddd │
└───┴──────┘
```

<h2 id="additional_table_filters">
  additional\_table\_filters
</h2>

<SettingsInfoBlock type="Map" default_value="{}" />

An additional filter expression that is applied after reading
from the specified table.

**Example**

```sql theme={null}
INSERT INTO table_1 VALUES (1, 'a'), (2, 'bb'), (3, 'ccc'), (4, 'dddd');
SELECT * FROM table_1;
```

```response theme={null}
┌─x─┬─y────┐
│ 1 │ a    │
│ 2 │ bb   │
│ 3 │ ccc  │
│ 4 │ dddd │
└───┴──────┘
```

```sql theme={null}
SELECT *
FROM table_1
SETTINGS additional_table_filters = {'table_1': 'x != 2'}
```

```response theme={null}
┌─x─┬─y────┐
│ 1 │ a    │
│ 3 │ ccc  │
│ 4 │ dddd │
└───┴──────┘
```

<h2 id="aggregate_function_input_format">
  aggregate\_function\_input\_format
</h2>

<SettingsInfoBlock type="AggregateFunctionInputFormat" default_value="state" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "state"},{"label": "New setting to control AggregateFunction input format during INSERT operations. Setting Value set to state by default"}]}]} />

Format for AggregateFunction input during INSERT operations.

Possible values:

* `state` — Binary string with the serialized state (the default). This is the default behavior where AggregateFunction values are expected as binary data.
* `value` — The format expects a single value of the argument of the aggregate function, or in the case of multiple arguments, a tuple of them. They will be deserialized using the corresponding IDataType or DataTypeTuple and then aggregated to form the state.
* `array` — The format expects an Array of values, as described in the `value` option above. All elements of the array will be aggregated to form the state.

**Examples**

For a table with structure:

```sql theme={null}
CREATE TABLE example (
    user_id UInt64,
    avg_session_length AggregateFunction(avg, UInt32)
);
```

With `aggregate_function_input_format = 'value'`:

```sql theme={null}
INSERT INTO example FORMAT CSV
123,456
```

With `aggregate_function_input_format = 'array'`:

```sql theme={null}
INSERT INTO example FORMAT CSV
123,"[456,789,101]"
```

Note: The `value` and `array` formats are slower than the default `state` format as they require creating and aggregating values during insertion.

<h2 id="aggregate_functions_null_for_empty">
  aggregate\_functions\_null\_for\_empty
</h2>

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

Enables or disables rewriting all aggregate functions in a query, adding [-OrNull](/reference/functions/aggregate-functions/combinators#-ornull) suffix to them. Enable it for SQL standard compatibility.
It is implemented via query rewrite (similar to [count\_distinct\_implementation](#count_distinct_implementation) setting) to get consistent results for distributed queries.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

**Example**

Consider the following query with aggregate functions:

```sql theme={null}
SELECT SUM(-1), MAX(0) FROM system.one WHERE 0;
```

With `aggregate_functions_null_for_empty = 0` it would produce:

```text theme={null}
┌─SUM(-1)─┬─MAX(0)─┐
│       0 │      0 │
└─────────┴────────┘
```

With `aggregate_functions_null_for_empty = 1` the result would be:

```text theme={null}
┌─SUMOrNull(-1)─┬─MAXOrNull(0)─┐
│          NULL │         NULL │
└───────────────┴──────────────┘
```

<h2 id="aggregation_in_order_max_block_bytes">
  aggregation\_in\_order\_max\_block\_bytes
</h2>

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

Maximal size of block in bytes accumulated during aggregation in order of primary key. Lower block size allows to parallelize more final merge stage of aggregation.

<h2 id="aggregation_memory_efficient_merge_threads">
  aggregation\_memory\_efficient\_merge\_threads
</h2>

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

Number of threads to use for merge intermediate aggregation results in memory efficient mode. When bigger, then more memory is consumed. 0 means - same as 'max\_threads'.

<h2 id="ai_function_credentials">
  ai\_function\_credentials
</h2>

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

Name of the named collection that AI functions use for provider credentials and configuration (`provider`, `endpoint`, `model`, optional `api_key`, etc.). When empty, an exception is raised.

<h2 id="ai_function_embedding_max_batch_size">
  ai\_function\_embedding\_max\_batch\_size
</h2>

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

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

Maximum number of texts to include in a single HTTP request made by `aiEmbed`. Texts are grouped into batches of this size to reduce API call overhead. For example, 500 unique texts with a batch size of 100 result in 5 HTTP requests.

<h2 id="ai_function_max_api_calls_per_query">
  ai\_function\_max\_api\_calls\_per\_query
</h2>

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

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

Maximum number of HTTP requests that AI functions may dispatch per query. Set to 0 to disable.

<h2 id="ai_function_max_input_tokens_per_query">
  ai\_function\_max\_input\_tokens\_per\_query
</h2>

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

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

Maximum total input (prompt) tokens across all AI function API calls in a single query. Tracked cumulatively from provider responses. Note that this limit may be exceeded by one call's worth of input tokens, since the number of input tokens of a call are not known in advance. Set to 0 to disable.

This limit is only enforced for providers that report a `usage` object in their response (OpenAI, Anthropic, vLLM). Providers that omit token usage (notably HuggingFace TEI) cause the counter to stay at 0 — use `ai_function_max_api_calls_per_query` instead to bound such calls.

<h2 id="ai_function_max_output_tokens_per_query">
  ai\_function\_max\_output\_tokens\_per\_query
</h2>

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

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

Maximum total output (completion) tokens across all AI function API calls in a single query. Tracked cumulatively from provider responses. Note that this limit may be exceeded by one call's worth of output tokens, since the number of output tokens of a call are not known in advance. Set to 0 to disable.

This limit is only enforced for providers that report a `usage` object in their response (OpenAI, Anthropic, vLLM). It does not apply to embedding functions (notably aiEmbed), which never produce output tokens.

<h2 id="ai_function_max_retries">
  ai\_function\_max\_retries
</h2>

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

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

Maximum number of retry attempts for transient errors per individual API request. Each retry uses exponential backoff starting from `ai_function_retry_initial_delay_ms`.

<h2 id="ai_function_request_timeout_sec">
  ai\_function\_request\_timeout\_sec
</h2>

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

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

Timeout in seconds for individual HTTP requests made by AI functions (AI chat completions and embedding API calls). If a request does not complete within this time, it is considered failed and may be retried according to `ai_function_max_retries`.

<h2 id="ai_function_retry_initial_delay_ms">
  ai\_function\_retry\_initial\_delay\_ms
</h2>

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

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

Initial delay in milliseconds before the first retry of a failed AI function API request. The delay doubles on each subsequent attempt (exponential backoff). For example, with default settings: 1000ms, 2000ms, 4000ms.

<h2 id="ai_function_throw_on_error">
  ai\_function\_throw\_on\_error
</h2>

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

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

If true (default), an AI function call that fails permanently after exhausting all retries aborts the query with an exception. If false, the failed row receives the default value for the column type (empty string for String) and processing continues.

<h2 id="ai_function_throw_on_quota_exceeded">
  ai\_function\_throw\_on\_quota\_exceeded
</h2>

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

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

If true (default), exceeding an AI function quota limit (`ai_function_max_input_tokens_per_query`, `ai_function_max_output_tokens_per_query`, or `ai_function_max_api_calls_per_query`) aborts the query with an exception. If false, remaining rows receive the default value for the column type (empty string for String).

<h2 id="allow_aggregate_partitions_independently">
  allow\_aggregate\_partitions\_independently
</h2>

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

Enable independent aggregation of partitions on separate threads when partition key suits group by key. Beneficial when number of partitions close to number of cores and partitions have roughly the same size

<h2 id="allow_archive_path_syntax">
  allow\_archive\_path\_syntax
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "1"},{"label": "Added new setting to allow disabling archive path syntax."}]}, {"id": "row-2","items": [{"label": "24.5"},{"label": "1"},{"label": "Added new setting to allow disabling archive path syntax."}]}]} />

File/S3 engines/table function will parse paths with '::' as `<archive> :: <file>` if the archive has correct extension.

<h2 id="allow_asynchronous_read_from_io_pool_for_merge_tree">
  allow\_asynchronous\_read\_from\_io\_pool\_for\_merge\_tree
</h2>

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

Use background I/O pool to read from MergeTree tables. This setting may increase performance for I/O bound queries

<h2 id="allow_calculating_subcolumns_sizes_for_merge_tree_reading">
  allow\_calculating\_subcolumns\_sizes\_for\_merge\_tree\_reading
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "1"},{"label": "Allow calculating subcolumns sizes for merge tree reading to improve read tasks splitting"}]}]} />

When enabled, ClickHouse will calculate the size of files required for each subcolumn reading for better task and block sizes calculation.

<h2 id="allow_changing_replica_until_first_data_packet">
  allow\_changing\_replica\_until\_first\_data\_packet
</h2>

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

If it's enabled, in hedged requests we can start new connection until receiving first data packet even if we have already made some progress
(but progress haven't updated for `receive_data_timeout` timeout), otherwise we disable changing replica after the first time we made progress.

<h2 id="allow_create_index_without_type">
  allow\_create\_index\_without\_type
</h2>

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

Allow CREATE INDEX query without TYPE. Query will be ignored. Made for SQL compatibility tests.

<h2 id="allow_custom_error_code_in_throwif">
  allow\_custom\_error\_code\_in\_throwif
</h2>

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

Enable custom error code in function throwIf(). If true, thrown exceptions may have unexpected error codes.

<h2 id="allow_ddl">
  allow\_ddl
</h2>

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

If it is set to true, then a user is allowed to executed DDL queries.

<h2 id="allow_deprecated_database_ordinary">
  allow\_deprecated\_database\_ordinary
</h2>

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

Allow to create databases with deprecated Ordinary engine

<h2 id="allow_deprecated_error_prone_window_functions">
  allow\_deprecated\_error\_prone\_window\_functions
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.5"},{"label": "0"},{"label": "Allow usage of deprecated error prone window functions (neighbor, runningAccumulate, runningDifferenceStartingWithFirstValue, runningDifference)"}]}]} />

Allow usage of deprecated error prone window functions (neighbor, runningAccumulate, runningDifferenceStartingWithFirstValue, runningDifference)

<h2 id="allow_deprecated_snowflake_conversion_functions">
  allow\_deprecated\_snowflake\_conversion\_functions
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "Disabled deprecated functions snowflakeToDateTime[64] and dateTime[64]ToSnowflake."}]}]} />

Functions `snowflakeToDateTime`, `snowflakeToDateTime64`, `dateTimeToSnowflake`, and `dateTime64ToSnowflake` are deprecated and disabled by default.
Please use functions `snowflakeIDToDateTime`, `snowflakeIDToDateTime64`, `dateTimeToSnowflakeID`, and `dateTime64ToSnowflakeID` instead.

To re-enable the deprecated functions (e.g., during a transition period), please set this setting to `true`.

<h2 id="allow_deprecated_syntax_for_merge_tree">
  allow\_deprecated\_syntax\_for\_merge\_tree
</h2>

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

Allow to create \*MergeTree tables with deprecated engine definition syntax

<h2 id="allow_distributed_ddl">
  allow\_distributed\_ddl
</h2>

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

If it is set to true, then a user is allowed to executed distributed DDL queries.

<h2 id="allow_drop_detached">
  allow\_drop\_detached
</h2>

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

Allow ALTER TABLE ... DROP DETACHED PART\[ITION] ... queries

<h2 id="allow_dynamic_type_in_join_keys">
  allow\_dynamic\_type\_in\_join\_keys
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "0"},{"label": "Disallow using Dynamic type in JOIN keys by default"}]}]} />

Allows using Dynamic type in JOIN keys. Added for compatibility. It's not recommended to use Dynamic type in JOIN keys because comparison with other types may lead to unexpected results.

<h2 id="allow_execute_multiif_columnar">
  allow\_execute\_multiif\_columnar
</h2>

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

Allow execute multiIf function columnar

<h2 id="allow_experimental_ai_functions">
  allow\_experimental\_ai\_functions
</h2>

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

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

Enable experimental AI functions (e.g. `aiGenerateContent`). These functions make external HTTP calls to AI providers.

<h2 id="allow_experimental_analyzer">
  allow\_experimental\_analyzer
</h2>

**Aliases**: `enable_analyzer`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "Enable analyzer and planner by default."}]}]} />

Allow new query analyzer.

<h2 id="allow_experimental_cleanup_old_data_files_compaction">
  allow\_experimental\_cleanup\_old\_data\_files\_compaction
</h2>

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

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

Allow to clean up old data files during Iceberg compaction.

<h2 id="allow_experimental_codecs">
  allow\_experimental\_codecs
</h2>

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

If it is set to true, allow to specify experimental compression codecs (but we don't have those yet and this option does nothing).

<h2 id="allow_experimental_correlated_subqueries">
  allow\_experimental\_correlated\_subqueries
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "Mark correlated subqueries support as Beta."}]}, {"id": "row-2","items": [{"label": "25.4"},{"label": "0"},{"label": "Added new setting to allow correlated subqueries execution."}]}]} />

Allow to execute correlated subqueries.

<h2 id="allow_experimental_database_glue_catalog">
  allow\_experimental\_database\_glue\_catalog
</h2>

**Aliases**: `allow_database_glue_catalog`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.3"},{"label": "0"},{"label": "Allow experimental database engine DataLakeCatalog with catalog_type = 'glue'"}]}]} />

Allow experimental database engine DataLakeCatalog with catalog\_type = 'glue'

Cloud default value: `1`.

<h2 id="allow_experimental_database_hms_catalog">
  allow\_experimental\_database\_hms\_catalog
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "0"},{"label": "Allow experimental database engine DataLakeCatalog with catalog_type = 'hive'"}]}]} />

Allow experimental database engine DataLakeCatalog with catalog\_type = 'hms'

<h2 id="allow_experimental_database_iceberg">
  allow\_experimental\_database\_iceberg
</h2>

**Aliases**: `allow_database_iceberg`

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

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

Allow experimental database engine DataLakeCatalog with catalog\_type = 'iceberg'

Cloud default value: `1`.

<h2 id="allow_experimental_database_materialized_postgresql">
  allow\_experimental\_database\_materialized\_postgresql
</h2>

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

Allow to create database with Engine=MaterializedPostgreSQL(...).

<h2 id="allow_experimental_database_paimon_rest_catalog">
  allow\_experimental\_database\_paimon\_rest\_catalog
</h2>

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

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

Allow experimental database engine DataLakeCatalog with catalog\_type = 'paimon\_rest'

<h2 id="allow_experimental_database_unity_catalog">
  allow\_experimental\_database\_unity\_catalog
</h2>

**Aliases**: `allow_database_unity_catalog`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.3"},{"label": "0"},{"label": "Allow experimental database engine DataLakeCatalog with catalog_type = 'unity'"}]}]} />

Allow experimental database engine DataLakeCatalog with catalog\_type = 'unity'

Cloud default value: `1`.

<h2 id="allow_experimental_delta_kernel_rs">
  allow\_experimental\_delta\_kernel\_rs
</h2>

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

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

Allow experimental delta-kernel-rs implementation.

<h2 id="allow_experimental_delta_lake_writes">
  allow\_experimental\_delta\_lake\_writes
</h2>

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

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

Enables delta-kernel writes feature.

<h2 id="allow_experimental_expire_snapshots">
  allow\_experimental\_expire\_snapshots
</h2>

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

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

Allow to execute experimental Iceberg command `ALTER TABLE ... EXECUTE expire_snapshots`.

<h2 id="allow_experimental_funnel_functions">
  allow\_experimental\_funnel\_functions
</h2>

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

Enable experimental functions for funnel analysis.

<h2 id="allow_experimental_geo_types_in_iceberg">
  allow\_experimental\_geo\_types\_in\_iceberg
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting to allow parsing Iceberg geometry/geography fields as Geometry type."}]}]} />

Allow parsing Iceberg `geometry` and `geography` field types as ClickHouse `Geometry` (Variant) type.

<h2 id="allow_experimental_hash_functions">
  allow\_experimental\_hash\_functions
</h2>

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

Enable experimental hash functions

<h2 id="allow_experimental_iceberg_compaction">
  allow\_experimental\_iceberg\_compaction
</h2>

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

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

Allow to explicitly use 'OPTIMIZE' for iceberg tables.

<h2 id="allow_experimental_join_right_table_sorting">
  allow\_experimental\_join\_right\_table\_sorting
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "0"},{"label": "If it is set to true, and the conditions of `join_to_sort_minimum_perkey_rows` and `join_to_sort_maximum_table_rows` are met, rerange the right table by key to improve the performance in left or inner hash join"}]}]} />

If it is set to true, and the conditions of `join_to_sort_minimum_perkey_rows` and `join_to_sort_maximum_table_rows` are met, rerange the right table by key to improve the performance in left or inner hash join.

<h2 id="allow_experimental_json_lazy_type_hints">
  allow\_experimental\_json\_lazy\_type\_hints
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "New experimental setting for lazy JSON type hints"}]}]} />

Enable experimental lazy type hints for JSON type. This feature allows optimizing JSON type conversions by deferring type hint evaluation.

<h2 id="allow_experimental_kafka_offsets_storage_in_keeper">
  allow\_experimental\_kafka\_offsets\_storage\_in\_keeper
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "0"},{"label": "Allow the usage of experimental Kafka storage engine that stores the committed offsets in ClickHouse Keeper"}]}]} />

Allow experimental feature to store Kafka related offsets in ClickHouse Keeper. When enabled a ClickHouse Keeper path and replica name can be specified to the Kafka table engine. As a result instead of the regular Kafka engine, a new type of storage engine will be used that stores the committed offsets primarily in ClickHouse Keeper

<h2 id="allow_experimental_kusto_dialect">
  allow\_experimental\_kusto\_dialect
</h2>

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

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

Enable Kusto Query Language (KQL) - an alternative to SQL.

<h2 id="allow_experimental_materialized_postgresql_table">
  allow\_experimental\_materialized\_postgresql\_table
</h2>

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

Allows to use the MaterializedPostgreSQL table engine. Disabled by default, because this feature is experimental

<h2 id="allow_experimental_nlp_functions">
  allow\_experimental\_nlp\_functions
</h2>

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

Enable experimental functions for natural language processing.

<h2 id="allow_experimental_nullable_tuple_type">
  allow\_experimental\_nullable\_tuple\_type
</h2>

**Aliases**: `enable_nullable_tuple_type`

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

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

Allows creation of [Nullable](/reference/data-types/nullable) [Tuple](/reference/data-types/tuple) columns in tables.

This setting does not control whether extracted tuple subcolumns can be `Nullable` (for example, from Dynamic, Variant, JSON, or Tuple columns).
Use `allow_nullable_tuple_in_extracted_subcolumns` to control whether extracted tuple subcolumns can be `Nullable`.

<h2 id="allow_experimental_object_storage_queue_hive_partitioning">
  allow\_experimental\_object\_storage\_queue\_hive\_partitioning
</h2>

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

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

Allow to use hive partitioning with S3Queue/AzureQueue engines

<h2 id="allow_experimental_paimon_storage_engine">
  allow\_experimental\_paimon\_storage\_engine
</h2>

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

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

Allow to create tables with Paimon\* table engines.

<h2 id="allow_experimental_parallel_reading_from_replicas">
  allow\_experimental\_parallel\_reading\_from\_replicas
</h2>

**Aliases**: `enable_parallel_replicas`

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

Use up to `max_parallel_replicas` the number of replicas from each shard for SELECT query execution. Reading is parallelized and coordinated dynamically. 0 - disabled, 1 - enabled, silently disable them in case of failure, 2 - enabled, throw an exception in case of failure

<h2 id="allow_experimental_polyglot_dialect">
  allow\_experimental\_polyglot\_dialect
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "New setting to enable the polyglot SQL transpiler dialect."}]}]} />

Enable polyglot SQL transpiler - transpiles SQL from 30+ dialects (MySQL, PostgreSQL, SQLite, Snowflake, DuckDB, etc.) into ClickHouse SQL.

<h2 id="allow_experimental_prql_dialect">
  allow\_experimental\_prql\_dialect
</h2>

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

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

Enable PRQL - an alternative to SQL.

<h2 id="allow_experimental_text_index_lazy_apply">
  allow\_experimental\_text\_index\_lazy\_apply
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "0"},{"label": "New setting to gate experimental lazy posting list apply mode"}]}]} />

If set to true, allow using the lazy posting list apply mode for text index queries.

<h2 id="allow_experimental_time_series_aggregate_functions">
  allow\_experimental\_time\_series\_aggregate\_functions
</h2>

**Aliases**: `allow_experimental_ts_to_grid_aggregate_function`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "0"},{"label": "New setting to enable experimental timeSeries* aggregate functions."}]}]} />

Experimental timeSeries\* aggregate functions for Prometheus-like timeseries resampling, rate, delta calculation.

<h2 id="allow_experimental_time_series_table">
  allow\_experimental\_time\_series\_table
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "0"},{"label": "Added new setting to allow the TimeSeries table engine"}]}]} />

Allows creation of tables with the [TimeSeries](/reference/engines/table-engines/integrations/time-series) table engine. Possible values:

* 0 — the [TimeSeries](/reference/engines/table-engines/integrations/time-series) table engine is disabled.
* 1 — the [TimeSeries](/reference/engines/table-engines/integrations/time-series) table engine is enabled.

<h2 id="allow_experimental_unique_key">
  allow\_experimental\_unique\_key
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting to gate the experimental UNIQUE KEY clause on MergeTree-family tables"}]}]} />

Allows creation of tables with the `UNIQUE KEY` clause on MergeTree-family engines.

<h2 id="allow_experimental_window_view">
  allow\_experimental\_window\_view
</h2>

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

Enable WINDOW VIEW. Not mature enough.

<h2 id="allow_experimental_ytsaurus_dictionary_source">
  allow\_experimental\_ytsaurus\_dictionary\_source
</h2>

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

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

Experimental dictionary source for integration with YTsaurus.

<h2 id="allow_experimental_ytsaurus_table_engine">
  allow\_experimental\_ytsaurus\_table\_engine
</h2>

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

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

Experimental table engine for integration with YTsaurus.

<h2 id="allow_experimental_ytsaurus_table_function">
  allow\_experimental\_ytsaurus\_table\_function
</h2>

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

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

Experimental table engine for integration with YTsaurus.

<h2 id="allow_fuzz_query_functions">
  allow\_fuzz\_query\_functions
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "New setting to enable the fuzzQuery function."}]}]} />

Enables the `fuzzQuery` function that applies random AST mutations to a query string.

<h2 id="allow_general_join_planning">
  allow\_general\_join\_planning
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "Allow more general join planning algorithm when hash join algorithm is enabled."}]}]} />

Allows a more general join planning algorithm that can handle more complex conditions, but only works with hash join. If hash join is not enabled, then the usual join planning algorithm is used regardless of the value of this setting.

<h2 id="allow_get_client_http_header">
  allow\_get\_client\_http\_header
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "Introduced a new function."}]}]} />

Allow to use the function `getClientHTTPHeader` which lets to obtain a value of an the current HTTP request's header. It is not enabled by default for security reasons, because some headers, such as `Cookie`, could contain sensitive info. Note that the `X-ClickHouse-*` and `Authentication` headers are always restricted and cannot be obtained with this function.

<h2 id="allow_hyperscan">
  allow\_hyperscan
</h2>

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

Allow functions that use Hyperscan library. Disable to avoid potentially long compilation times and excessive resource usage.

<h2 id="allow_iceberg_remove_orphan_files">
  allow\_iceberg\_remove\_orphan\_files
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "New setting to gate Iceberg orphan file removal"}]}]} />

Allow to use 'ALTER TABLE ... EXECUTE remove\_orphan\_files()' for iceberg tables.

<h2 id="allow_insert_into_iceberg">
  allow\_insert\_into\_iceberg
</h2>

**Aliases**: `allow_experimental_insert_into_iceberg`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "Insert into iceberg was moved to Beta"}]}, {"id": "row-2","items": [{"label": "25.7"},{"label": "0"},{"label": "New setting."}]}]} />

Allow to execute `insert` queries into iceberg.

<h2 id="allow_introspection_functions">
  allow\_introspection\_functions
</h2>

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

Enables or disables [introspection functions](/reference/functions/regular-functions/introspection) for query profiling.

Possible values:

* 1 — Introspection functions enabled.
* 0 — Introspection functions disabled.

**See Also**

* [Sampling Query Profiler](/concepts/features/performance/troubleshoot/sampling-query-profiler)
* System table [trace\_log](/reference/system-tables/trace_log)

<h2 id="allow_key_condition_coalesce_rewrite">
  allow\_key\_condition\_coalesce\_rewrite
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1"},{"label": "New setting to rewrite predicates of the form `coalesce(a_1, ..., a_N) <op> const` (and equivalently `ifNull`, or with the constant on the left) into a disjunction before index analysis, so per-column primary key and skip indexes on each `a_i` can be used. Partial-constant forms such as `coalesce(a, 42, b)` and `coalesce(a, b, 42)` are also handled."}]}]} />

Allow the MergeTree primary key and skip indexes to prune granules for `WHERE`/`PREWHERE` predicates that involve `coalesce` or `ifNull`. Without this setting, such predicates are opaque to index analysis and do not prune, so granules that cannot match are still read. This affects only which granules are read; query results are unchanged, because rows are still filtered by the original predicate.

Two predicate shapes are rewritten before index analysis:

* A comparison against a `coalesce`/`ifNull`, such as `coalesce(a, b) = 5`, becomes a disjunction so an index on each argument can prune: `a = 5 OR (a IS NULL AND b = 5)`, extended for more arguments.
* A `coalesce`/`ifNull` with a falsy (zero) constant default used directly as a condition, such as `ifNull(a = 5, 0)` or `coalesce(a = 5, 0)`, is unwrapped to its inner predicate `a = 5`. Such wrappers collapse the inner predicate's three-valued result into a definite boolean (mapping `NULL` to `false`).

<h2 id="allow_limit_by_partitions_independently">
  allow\_limit\_by\_partitions\_independently
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1"},{"label": "New setting to enable independent per-partition evaluation of `LIMIT BY` when the partition expression is a deterministic function of the `LIMIT BY` columns."}]}]} />

Enable independent `LIMIT BY` evaluation per partition on separate threads when the partition expression is a deterministic function of the `LIMIT BY` columns.

<h2 id="allow_materialized_view_with_bad_select">
  allow\_materialized\_view\_with\_bad\_select
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "0"},{"label": "Don't allow creating MVs referencing nonexistent columns or tables"}]}, {"id": "row-2","items": [{"label": "24.9"},{"label": "1"},{"label": "Support (but not enable yet) stricter validation in CREATE MATERIALIZED VIEW"}]}]} />

Allow CREATE MATERIALIZED VIEW with SELECT query that references nonexistent tables or columns. It must still be syntactically valid. Doesn't apply to refreshable MVs. Doesn't apply if the MV schema needs to be inferred from the SELECT query (i.e. if the CREATE has no column list and no TO table). Can be used for creating MV before its source table.

<h2 id="allow_named_collection_override_by_default">
  allow\_named\_collection\_override\_by\_default
</h2>

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

Allow named collections' fields override by default.

<h2 id="allow_non_metadata_alters">
  allow\_non\_metadata\_alters
</h2>

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

Allow to execute alters which affects not only tables metadata, but also data on disk

<h2 id="allow_nonconst_timezone_arguments">
  allow\_nonconst\_timezone\_arguments
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.4"},{"label": "0"},{"label": "Allow non-const timezone arguments in certain time-related functions like toTimeZone(), fromUnixTimestamp*(), snowflakeToDateTime*()."}]}]} />

Allow non-const timezone arguments in certain time-related functions like toTimeZone(), fromUnixTimestamp\*(), snowflakeToDateTime\*().
This setting exists only for compatibility reasons. In ClickHouse, the time zone is a property of the data type, respectively of the column.
Enabling this setting gives the wrong impression that different values within a column can have different timezones.
Therefore, please do not enable this setting.

<h2 id="allow_nondeterministic_mutations">
  allow\_nondeterministic\_mutations
</h2>

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

User-level setting that allows mutations on replicated tables to make use of non-deterministic functions such as `dictGet`.

Given that, for example, dictionaries, can be out of sync across nodes, mutations that pull values from them are disallowed on replicated tables by default. Enabling this setting allows this behavior, making it the user's responsibility to ensure that the data used is in sync across all nodes.

**Example**

```xml theme={null}
<profiles>
    <default>
        <allow_nondeterministic_mutations>1</allow_nondeterministic_mutations>

        <!-- ... -->
    </default>

    <!-- ... -->

</profiles>
```

<h2 id="allow_nondeterministic_optimize_skip_unused_shards">
  allow\_nondeterministic\_optimize\_skip\_unused\_shards
</h2>

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

Allow nondeterministic (like `rand` or `dictGet`, since later has some caveats with updates) functions in sharding key.

Possible values:

* 0 — Disallowed.
* 1 — Allowed.

<h2 id="allow_nullable_tuple_in_extracted_subcolumns">
  allow\_nullable\_tuple\_in\_extracted\_subcolumns
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "New setting controlling whether extracted Tuple subcolumns can be nullable."}]}]} />

Controls whether extracted subcolumns of type `Tuple(...)` can be typed as `Nullable(Tuple(...))`.

* `false`: Return `Tuple(...)` and use default tuple values for rows where the subcolumn is missing.
* `true`: Return `Nullable(Tuple(...))` and use `NULL` for rows where the subcolumn is missing.

This setting controls extracted subcolumn behavior only.
It does not control whether `Nullable(Tuple(...))` columns can be created in tables; that is controlled by `enable_nullable_tuple_type`.

ClickHouse uses the value for this setting loaded at server startup.
Changes made with `SET` or query-level `SETTINGS` do not change extracted subcolumn behavior.
To change extracted subcolumn behavior, update `allow_nullable_tuple_in_extracted_subcolumns` in startup profile configuration (for example, users.xml) and restart the server.

<h2 id="allow_prefetched_read_pool_for_local_filesystem">
  allow\_prefetched\_read\_pool\_for\_local\_filesystem
</h2>

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

Prefer prefetched threadpool if all parts are on local filesystem

<h2 id="allow_prefetched_read_pool_for_remote_filesystem">
  allow\_prefetched\_read\_pool\_for\_remote\_filesystem
</h2>

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

Prefer prefetched threadpool if all parts are on remote filesystem

<h2 id="allow_push_predicate_ast_for_distributed_subqueries">
  allow\_push\_predicate\_ast\_for\_distributed\_subqueries
</h2>

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

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

Allows push predicate on AST level for distributed subqueries with enabled anlyzer

<h2 id="allow_push_predicate_when_subquery_contains_with">
  allow\_push\_predicate\_when\_subquery\_contains\_with
</h2>

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

Allows push predicate when subquery contains WITH clause

<h2 id="allow_rank_dense_rank_arguments">
  allow\_rank\_dense\_rank\_arguments
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting. Before 26.5, the `RANK` and `DENSE_RANK` window functions silently ignored any provided arguments (equivalent to `allow_rank_dense_rank_arguments = 1`). From 26.5, they reject arguments by default with `NUMBER_OF_ARGUMENTS_DOESNT_MATCH` because per SQL standard these functions take zero arguments. Set this to `1` to restore the legacy behavior."}]}]} />

Allow passing arguments to the `RANK` and `DENSE_RANK` window functions for backward compatibility.

Per SQL standard, `RANK` and `DENSE_RANK` take zero arguments — they rank rows based on the
`OVER (ORDER BY ...)` window only. In ClickHouse versions before 26.5, queries such as
`RANK(x) OVER (...)` silently accepted and ignored the argument, which led to user confusion
(the visible argument suggested it influenced the ranking, but it did not).

When this setting is `false` (the default), `RANK` and `DENSE_RANK` reject any arguments and
throw `NUMBER_OF_ARGUMENTS_DOESNT_MATCH`. When set to `true`, the legacy lenient behavior is
restored — arguments are silently ignored, matching the pre-26.5 behavior.

<h2 id="allow_reorder_prewhere_conditions">
  allow\_reorder\_prewhere\_conditions
</h2>

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

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

When moving conditions from WHERE to PREWHERE, allow reordering them to optimize filtering

<h2 id="allow_settings_after_format_in_insert">
  allow\_settings\_after\_format\_in\_insert
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.4"},{"label": "0"},{"label": "Do not allow SETTINGS after FORMAT for INSERT queries because ClickHouse interpret SETTINGS as some values, which is misleading"}]}]} />

Control whether `SETTINGS` after `FORMAT` in `INSERT` queries is allowed or not. It is not recommended to use this, since this may interpret part of `SETTINGS` as values.

Example:

```sql theme={null}
INSERT INTO FUNCTION null('foo String') SETTINGS max_threads=1 VALUES ('bar');
```

But the following query will work only with `allow_settings_after_format_in_insert`:

```sql theme={null}
SET allow_settings_after_format_in_insert=1;
INSERT INTO FUNCTION null('foo String') VALUES ('bar') SETTINGS max_threads=1;
```

Possible values:

* 0 — Disallow.
* 1 — Allow.

<Note>
  Use this setting only for backward compatibility if your use cases depend on old syntax.
</Note>

<h2 id="allow_simdjson">
  allow\_simdjson
</h2>

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

Allow using simdjson library in 'JSON\*' functions if AVX2 instructions are available. If disabled rapidjson will be used.

<h2 id="allow_special_serialization_kinds_in_output_formats">
  allow\_special\_serialization\_kinds\_in\_output\_formats
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1"},{"label": "Enable direct output of special columns representations like Sparse/Replicated in some output formats"}]}, {"id": "row-2","items": [{"label": "25.10"},{"label": "0"},{"label": "Add a setting to allow output of special columns representations like Sparse/Replicated without converting them to full columns"}]}]} />

Allows to output columns with special serialization kinds like Sparse and Replicated without converting them to full column representation.
It helps to avoid unnecessary data copy during formatting.

<h2 id="allow_statistics">
  allow\_statistics
</h2>

**Aliases**: `allow_experimental_statistics`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "1"},{"label": "Column statistics are now GA"}]}]} />

Allows defining columns with [statistics](/reference/engines/table-engines/mergetree-family/mergetree#table_engine-mergetree-creating-a-table) and [manipulate statistics](/reference/engines/table-engines/mergetree-family/mergetree#column-statistics).

<h2 id="allow_statistics_optimize">
  allow\_statistics\_optimize
</h2>

**Aliases**: `allow_statistic_optimize`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "1"},{"label": "Enable this optimization by default."}]}, {"id": "row-2","items": [{"label": "24.6"},{"label": "0"},{"label": "The setting was renamed. The previous name is `allow_statistic_optimize`."}]}]} />

Allows using statistics to optimize queries

<h2 id="allow_suspicious_codecs">
  allow\_suspicious\_codecs
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "20.5"},{"label": "0"},{"label": "Don't allow to specify meaningless compression codecs"}]}]} />

If it is set to true, allow to specify meaningless compression codecs.

<h2 id="allow_suspicious_fixed_string_types">
  allow\_suspicious\_fixed\_string\_types
</h2>

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

In CREATE TABLE statement allows creating columns of type FixedString(n) with n > 256. FixedString with length >= 256 is suspicious and most likely indicates a misuse

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

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.4"},{"label": "0"},{"label": "If true, index can defined with identical expressions"}]}]} />

Reject primary/secondary indexes and sorting keys with identical expressions

<h2 id="allow_suspicious_low_cardinality_types">
  allow\_suspicious\_low\_cardinality\_types
</h2>

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

Allows or restricts using [LowCardinality](/reference/data-types/lowcardinality) with data types with fixed size of 8 bytes or less: numeric data types and `FixedString(8_bytes_or_less)`.

For small fixed values using of `LowCardinality` is usually inefficient, because ClickHouse stores a numeric index for each row. As a result:

* Disk space usage can rise.
* RAM consumption can be higher, depending on a dictionary size.
* Some functions can work slower due to extra coding/encoding operations.

Merge times in [MergeTree](/reference/engines/table-engines/mergetree-family/mergetree)-engine tables can grow due to all the reasons described above.

Possible values:

* 1 — Usage of `LowCardinality` is not restricted.
* 0 — Usage of `LowCardinality` is restricted.

<h2 id="allow_suspicious_primary_key">
  allow\_suspicious\_primary\_key
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "Forbid suspicious PRIMARY KEY/ORDER BY for MergeTree (i.e. SimpleAggregateFunction)"}]}]} />

Allow suspicious `PRIMARY KEY`/`ORDER BY` for MergeTree (i.e. SimpleAggregateFunction).

<h2 id="allow_suspicious_ttl_expressions">
  allow\_suspicious\_ttl\_expressions
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.12"},{"label": "0"},{"label": "It is a new setting, and in previous versions the behavior was equivalent to allowing."}]}]} />

Reject TTL expressions that don't depend on any of table's columns. It indicates a user error most of the time.

<h2 id="allow_suspicious_types_in_group_by">
  allow\_suspicious\_types\_in\_group\_by
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "0"},{"label": "Don't allow Variant/Dynamic types in GROUP BY by default"}]}]} />

Allows or restricts using [Variant](/reference/data-types/variant) and [Dynamic](/reference/data-types/dynamic) types in GROUP BY keys.

<h2 id="allow_suspicious_types_in_order_by">
  allow\_suspicious\_types\_in\_order\_by
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "0"},{"label": "Don't allow Variant/Dynamic types in ORDER BY by default"}]}]} />

Allows or restricts using [Variant](/reference/data-types/variant) and [Dynamic](/reference/data-types/dynamic) types in ORDER BY keys.

<h2 id="allow_suspicious_variant_types">
  allow\_suspicious\_variant\_types
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "0"},{"label": "Don't allow creating Variant type with suspicious variants by default"}]}]} />

In CREATE TABLE statement allows specifying Variant type with similar variant types (for example, with different numeric or date types). Enabling this setting may introduce some ambiguity when working with values with similar types.

<h2 id="allow_unrestricted_reads_from_keeper">
  allow\_unrestricted\_reads\_from\_keeper
</h2>

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

Allow unrestricted (without condition on path) reads from system.zookeeper table, can be handy, but is not safe for zookeeper

<h2 id="alter_move_to_space_execute_async">
  alter\_move\_to\_space\_execute\_async
</h2>

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

Execute ALTER TABLE MOVE ... TO \[DISK|VOLUME] asynchronously

<h2 id="alter_partition_verbose_result">
  alter\_partition\_verbose\_result
</h2>

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

Enables or disables the display of information about the parts to which the manipulation operations with partitions and parts have been successfully applied.
Applicable to [ATTACH PARTITION|PART](/reference/statements/alter/partition#attach-partitionpart) and to [FREEZE PARTITION](/reference/statements/alter/partition#freeze-partition).

Possible values:

* 0 — disable verbosity.
* 1 — enable verbosity.

**Example**

```sql theme={null}
CREATE TABLE test(a Int64, d Date, s String) ENGINE = MergeTree PARTITION BY toYYYYMDECLARE(d) ORDER BY a;
INSERT INTO test VALUES(1, '2021-01-01', '');
INSERT INTO test VALUES(1, '2021-01-01', '');
ALTER TABLE test DETACH PARTITION ID '202101';

ALTER TABLE test ATTACH PARTITION ID '202101' SETTINGS alter_partition_verbose_result = 1;

┌─command_type─────┬─partition_id─┬─part_name────┬─old_part_name─┐
│ ATTACH PARTITION │ 202101       │ 202101_7_7_0 │ 202101_5_5_0  │
│ ATTACH PARTITION │ 202101       │ 202101_8_8_0 │ 202101_6_6_0  │
└──────────────────┴──────────────┴──────────────┴───────────────┘

ALTER TABLE test FREEZE SETTINGS alter_partition_verbose_result = 1;

┌─command_type─┬─partition_id─┬─part_name────┬─backup_name─┬─backup_path───────────────────┬─part_backup_path────────────────────────────────────────────┐
│ FREEZE ALL   │ 202101       │ 202101_7_7_0 │ 8           │ /var/lib/clickhouse/shadow/8/ │ /var/lib/clickhouse/shadow/8/data/default/test/202101_7_7_0 │
│ FREEZE ALL   │ 202101       │ 202101_8_8_0 │ 8           │ /var/lib/clickhouse/shadow/8/ │ /var/lib/clickhouse/shadow/8/data/default/test/202101_8_8_0 │
└──────────────┴──────────────┴──────────────┴─────────────┴───────────────────────────────┴─────────────────────────────────────────────────────────────┘
```

<h2 id="alter_sync">
  alter\_sync
</h2>

**Aliases**: `replication_alter_partitions_sync`

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

Allows you to specify the wait behavior for actions that are to be executed on replicas by [`ALTER`](/reference/statements/alter/index), [`OPTIMIZE`](/reference/statements/optimize) or [`TRUNCATE`](/reference/statements/truncate) queries.

Possible values:

* `0` — Do not wait.
* `1` — Wait for own execution.
* `2` — Wait for everyone.
* `3` - Only wait for active replicas.

Cloud default value: `0`.

<Note>
  `alter_sync` is applicable to `Replicated` and `SharedMergeTree` tables only, it does nothing to alter non `Replicated` or `Shared` tables.
</Note>

<h2 id="alter_update_mode">
  alter\_update\_mode
</h2>

<SettingsInfoBlock type="AlterUpdateMode" default_value="heavy" />

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

A mode for `ALTER` queries that have the `UPDATE` commands.

Possible values:

* `heavy` - run regular mutation.
* `lightweight` - run lightweight update if possible, run regular mutation otherwise.
* `lightweight_force` - run lightweight update if possible, throw otherwise.

<h2 id="analyze_index_with_space_filling_curves">
  analyze\_index\_with\_space\_filling\_curves
</h2>

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

If a table has a space-filling curve in its index, e.g. `ORDER BY mortonEncode(x, y)` or `ORDER BY hilbertEncode(x, y)`, and the query has conditions on its arguments, e.g. `x >= 10 AND x <= 20 AND y >= 20 AND y <= 30`, use the space-filling curve for index analysis.

<h2 id="analyzer_compatibility_allow_compound_identifiers_in_unflatten_nested">
  analyzer\_compatibility\_allow\_compound\_identifiers\_in\_unflatten\_nested
</h2>

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

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

Allow to add compound identifiers to nested. This is a compatibility setting because it changes the query result. When disabled, `SELECT a.b.c FROM table ARRAY JOIN a` does not work, and `SELECT a FROM table` does not include `a.b.c` column into `Nested a` result.

<h2 id="analyzer_compatibility_join_using_top_level_identifier">
  analyzer\_compatibility\_join\_using\_top\_level\_identifier
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "Force to resolve identifier in JOIN USING from projection"}]}]} />

Force to resolve identifier in JOIN USING from projection (for example, in `SELECT a + 1 AS b FROM t1 JOIN t2 USING (b)` join will be performed by `t1.a + 1 = t2.b`, rather then `t1.b = t2.b`).

<h2 id="analyzer_compatibility_prefer_alias_over_subcolumn">
  analyzer\_compatibility\_prefer\_alias\_over\_subcolumn
</h2>

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

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

When a multi-part identifier like `b.id` could refer to either the column `id` of a table aliased `b` or to a Tuple subcolumn `b.id` of some other column, prefer the alias-prefix interpretation (column `id` of `b`). By default the new analyzer prefers the subcolumn. Enable to match the old analyzer's resolution.

<h2 id="analyzer_inline_views">
  analyzer\_inline\_views
</h2>

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

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

When enabled, the analyzer substitutes ordinary (non-materialized, non-parameterized) views with their defining subqueries, enabling cross-boundary optimizations such as predicate pushdown and column pruning.

<h2 id="any_join_distinct_right_table_keys">
  any\_join\_distinct\_right\_table\_keys
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "19.14"},{"label": "0"},{"label": "Disable ANY RIGHT and ANY FULL JOINs by default to avoid inconsistency"}]}]} />

Enables legacy ClickHouse server behaviour in `ANY INNER|LEFT JOIN` operations.

<Note>
  Use this setting only for backward compatibility if your use cases depend on legacy `JOIN` behaviour.
</Note>

When the legacy behaviour is enabled:

* Results of `t1 ANY LEFT JOIN t2` and `t2 ANY RIGHT JOIN t1` operations are not equal because ClickHouse uses the logic with many-to-one left-to-right table keys mapping.
* Results of `ANY INNER JOIN` operations contain all rows from the left table like the `SEMI LEFT JOIN` operations do.

When the legacy behaviour is disabled:

* Results of `t1 ANY LEFT JOIN t2` and `t2 ANY RIGHT JOIN t1` operations are equal because ClickHouse uses the logic which provides one-to-many keys mapping in `ANY RIGHT JOIN` operations.
* Results of `ANY INNER JOIN` operations contain one row per key from both the left and right tables.

Possible values:

* 0 — Legacy behaviour is disabled.
* 1 — Legacy behaviour is enabled.

See also:

* [JOIN strictness](/reference/statements/select/join#settings)

<h2 id="apply_deleted_mask">
  apply\_deleted\_mask
</h2>

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

Enables filtering out rows deleted with lightweight DELETE. If disabled, a query will be able to read those rows. This is useful for debugging and "undelete" scenarios

<h2 id="apply_mutations_on_fly">
  apply\_mutations\_on\_fly
</h2>

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

If true, mutations (UPDATEs and DELETEs) which are not materialized in data part will be applied on SELECTs.

<h2 id="apply_patch_parts">
  apply\_patch\_parts
</h2>

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

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

If true, patch parts (that represent lightweight updates) are applied on SELECTs.

<h2 id="apply_patch_parts_join_cache_buckets">
  apply\_patch\_parts\_join\_cache\_buckets
</h2>

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

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

The number of buckets in the temporary cache for applying patch parts in Join mode.

<h2 id="apply_prewhere_after_final">
  apply\_prewhere\_after\_final
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "0"},{"label": "New setting. When enabled, PREWHERE conditions are applied after FINAL processing."}]}]} />

When enabled, PREWHERE conditions are applied after FINAL processing for ReplacingMergeTree and similar engines.
This can be useful when PREWHERE references columns that may have different values across duplicate rows,
and you want FINAL to select the winning row before filtering. When disabled, PREWHERE is applied during reading.
Note: If apply\_row\_level\_security\_after\_final is enabled and row policy uses non-sorting-key columns, PREWHERE will also
be deferred to maintain correct execution order (row policy must be applied before PREWHERE).

<h2 id="apply_row_policy_after_final">
  apply\_row\_policy\_after\_final
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "1"},{"label": "Setting was added as a fix for the post-#87303 regression where row policies and PREWHERE were applied before FINAL. PR #91065 introduced the setting and PR #97279 made the correctness-safe true the default. Recorded as {true, true} so compatibility never reverts to the pre-fix false behavior."}]}]} />

When enabled, row policies and PREWHERE are applied after FINAL processing for \*MergeTree tables. (Especially for ReplacingMergeTree)
When disabled, row policies are applied before FINAL, which can cause different results when the policy
filters out rows that should be used for deduplication in ReplacingMergeTree or similar engines.

If the row policy expression depends only on columns in ORDER BY, it will still be applied before FINAL as an optimization,
since such filtering cannot affect the deduplication result.

Possible values:

* 0 — Row policy and PREWHERE are applied before FINAL (default).
* 1 — Row policy and PREWHERE are applied after FINAL.

<h2 id="apply_settings_from_server">
  apply\_settings\_from\_server
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "1"},{"label": "Client-side code (e.g. INSERT input parsing and query output formatting) will use the same settings as the server, including settings from server config."}]}]} />

Whether the client should accept settings from server.

This only affects operations performed on the client side, in particular parsing the INSERT input data and formatting the query result. Most of query execution happens on the server and is not affected by this setting.

Normally this setting should be set in user profile (users.xml or queries like `ALTER USER`), not through the client (client command line arguments, `SET` query, or `SETTINGS` section of `SELECT` query). Through the client it can be changed to false, but can't be changed to true (because the server won't send the settings if user profile has `apply_settings_from_server = false`).

Note that initially (24.12) there was a server setting (`send_settings_to_client`), but latter it got replaced with this client setting, for better usability.

<h2 id="archive_adaptive_buffer_max_size_bytes">
  archive\_adaptive\_buffer\_max\_size\_bytes
</h2>

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

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

Limits the maximum size of the adaptive buffer used when writing to archive files (for example, tar archives

<h2 id="arrow_flight_request_descriptor_type">
  arrow\_flight\_request\_descriptor\_type
</h2>

<SettingsInfoBlock type="ArrowFlightDescriptorType" default_value="path" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "path"},{"label": "New setting. Type of descriptor to use for Arrow Flight requests: 'path' or 'command'. Dremio requires 'command'."}]}]} />

Type of descriptor to use for Arrow Flight requests. 'path' sends the dataset name as a path descriptor. 'command' sends a SQL query as a command descriptor (required for Dremio).

Possible values:

* 'path' — Use FlightDescriptor::Path (default, works with most Arrow Flight servers)
* 'command' — Use FlightDescriptor::Command with a SELECT query (required for Dremio)

<h2 id="ast_fuzzer_any_query">
  ast\_fuzzer\_any\_query
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "New setting to allow fuzzing all query types, not just read-only."}]}]} />

When false (default), the server-side AST fuzzer (controlled by `ast_fuzzer_runs`) only fuzzes read-only queries (SELECT, EXPLAIN, SHOW, DESCRIBE, EXISTS). When true, all query types including DDL and INSERT are fuzzed.

<h2 id="ast_fuzzer_runs">
  ast\_fuzzer\_runs
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "New setting to enable server-side AST fuzzer."}]}]} />

Enables the server-side AST fuzzer that runs randomized queries after each normal query, discarding their results.

* 0: disabled (default).
* A value between 0 and 1 (exclusive): probability of running a single fuzzed query.
* A value >= 1: the number of fuzzed queries to run per normal query.

The fuzzer accumulates AST fragments from all queries across all sessions, producing increasingly interesting mutations over time. Fuzzed queries that fail are silently discarded; results are never returned to the client.

<h2 id="asterisk_include_alias_columns">
  asterisk\_include\_alias\_columns
</h2>

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

Include [ALIAS](/reference/statements/create/table#alias) columns for wildcard query (`SELECT *`).

Possible values:

* 0 - disabled
* 1 - enabled

<h2 id="asterisk_include_materialized_columns">
  asterisk\_include\_materialized\_columns
</h2>

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

Include [MATERIALIZED](/reference/statements/create/view#materialized-view) columns for wildcard query (`SELECT *`).

Possible values:

* 0 - disabled
* 1 - enabled

<h2 id="asterisk_include_virtual_columns">
  asterisk\_include\_virtual\_columns
</h2>

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

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

Include virtual columns for wildcard query (`SELECT *`).

Possible values:

* 0 - disabled
* 1 - enabled

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

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "Enable async inserts by default."}]}]} />

If true, data from INSERT query is stored in queue and later flushed to table in background. If wait\_for\_async\_insert is false, INSERT query is processed almost instantly, otherwise client will wait until data will be flushed to table

<h2 id="async_insert_busy_timeout_decrease_rate">
  async\_insert\_busy\_timeout\_decrease\_rate
</h2>

<SettingsInfoBlock type="Double" default_value="0.2" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "0.2"},{"label": "The exponential growth rate at which the adaptive asynchronous insert timeout decreases"}]}]} />

The exponential growth rate at which the adaptive asynchronous insert timeout decreases

<h2 id="async_insert_busy_timeout_increase_rate">
  async\_insert\_busy\_timeout\_increase\_rate
</h2>

<SettingsInfoBlock type="Double" default_value="0.2" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "0.2"},{"label": "The exponential growth rate at which the adaptive asynchronous insert timeout increases"}]}]} />

The exponential growth rate at which the adaptive asynchronous insert timeout increases

<h2 id="async_insert_busy_timeout_max_ms">
  async\_insert\_busy\_timeout\_max\_ms
</h2>

**Aliases**: `async_insert_busy_timeout_ms`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "200"},{"label": "The minimum value of the asynchronous insert timeout in milliseconds; async_insert_busy_timeout_ms is aliased to async_insert_busy_timeout_max_ms"}]}]} />

Maximum time to wait before dumping collected data per query since the first data appeared.

Cloud default value: `1000` (1s).

<h2 id="async_insert_busy_timeout_min_ms">
  async\_insert\_busy\_timeout\_min\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "50"},{"label": "The minimum value of the asynchronous insert timeout in milliseconds; it also serves as the initial value, which may be increased later by the adaptive algorithm"}]}]} />

If auto-adjusting is enabled through async\_insert\_use\_adaptive\_busy\_timeout, minimum time to wait before dumping collected data per query since the first data appeared. It also serves as the initial value for the adaptive algorithm

<h2 id="async_insert_deduplicate">
  async\_insert\_deduplicate
</h2>

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

For async INSERT queries in the replicated table, specifies that deduplication of inserting blocks should be performed

<h2 id="async_insert_max_data_size">
  async\_insert\_max\_data\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "10485760"},{"label": "The previous value appeared to be too small."}]}]} />

Maximum size in bytes of unparsed data collected per query before being inserted

Cloud default value: `104857600` (100 MiB).

<h2 id="async_insert_max_query_number">
  async\_insert\_max\_query\_number
</h2>

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

Maximum number of insert queries before being inserted.
Only takes effect if setting [`async_insert_deduplicate`](#async_insert_deduplicate) is 1.

<h2 id="async_insert_poll_timeout_ms">
  async\_insert\_poll\_timeout\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "10"},{"label": "Timeout in milliseconds for polling data from asynchronous insert queue"}]}]} />

Timeout for polling data from asynchronous insert queue

<h2 id="async_insert_use_adaptive_busy_timeout">
  async\_insert\_use\_adaptive\_busy\_timeout
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "1"},{"label": "Use adaptive asynchronous insert timeout"}]}]} />

If it is set to true, use adaptive busy timeout for asynchronous inserts

<h2 id="async_query_sending_for_remote">
  async\_query\_sending\_for\_remote
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.3"},{"label": "1"},{"label": "Create connections and send query async across shards"}]}]} />

Enables asynchronous connection creation and query sending while executing remote query.

Enabled by default.

<h2 id="async_socket_for_remote">
  async\_socket\_for\_remote
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.5"},{"label": "1"},{"label": "Fix all problems and turn on asynchronous reads from socket for remote queries by default again"}]}, {"id": "row-2","items": [{"label": "21.3"},{"label": "0"},{"label": "Turn off asynchronous reads from socket for remote queries because of some problems"}]}]} />

Enables asynchronous read from socket while executing remote query.

Enabled by default.

<h2 id="automatic_parallel_replicas_min_bytes_per_replica">
  automatic\_parallel\_replicas\_min\_bytes\_per\_replica
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "1048576"},{"label": "Better default value derived from testing results"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "0"},{"label": "New setting"}]}]} />

Threshold of bytes to read per replica to enable parallel replicas automatically (applies only when `automatic_parallel_replicas_mode`=1). 0 means no threshold.
The total number of bytes to read is estimated based on the collected statistics.

<h2 id="automatic_parallel_replicas_mode">
  automatic\_parallel\_replicas\_mode
</h2>

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

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

Enable automatic switching to execution with parallel replicas based on collected statistics. Requires `enable_analyzer = 1`, `enable_parallel_replicas != 0`, `parallel_replicas_local_plan = 1` and providing `cluster_for_parallel_replicas`.
0 - disabled, 1 - enabled, 2 - only statistics collection is enabled (switching to execution with parallel replicas is disabled).

<h2 id="azure_allow_parallel_part_upload">
  azure\_allow\_parallel\_part\_upload
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "true"},{"label": "Use multiple threads for azure multipart upload."}]}]} />

Use multiple threads for azure multipart upload.

<h2 id="azure_check_objects_after_upload">
  azure\_check\_objects\_after\_upload
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "0"},{"label": "Check each uploaded object in azure blob storage to be sure that upload was successful"}]}, {"id": "row-2","items": [{"label": "24.10"},{"label": "0"},{"label": "Check each uploaded object in azure blob storage to be sure that upload was successful"}]}]} />

Check each uploaded object in azure blob storage to be sure that upload was successful

<h2 id="azure_connect_timeout_ms">
  azure\_connect\_timeout\_ms
</h2>

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

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

Connection timeout for host from azure disks.

<h2 id="azure_create_new_file_on_insert">
  azure\_create\_new\_file\_on\_insert
</h2>

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

Enables or disables creating a new file on each insert in azure engine tables

<h2 id="azure_ignore_file_doesnt_exist">
  azure\_ignore\_file\_doesnt\_exist
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "Allow to return 0 rows when the requested files don't exist instead of throwing an exception in AzureBlobStorage table engine"}]}]} />

Ignore absence of file if it does not exist when reading certain keys.

Possible values:

* 1 — `SELECT` returns empty result.
* 0 — `SELECT` throws an exception.

<h2 id="azure_list_object_keys_size">
  azure\_list\_object\_keys\_size
</h2>

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

Maximum number of files that could be returned in batch by ListObject request

<h2 id="azure_max_blocks_in_multipart_upload">
  azure\_max\_blocks\_in\_multipart\_upload
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.5"},{"label": "50000"},{"label": "Maximum number of blocks in multipart upload for Azure."}]}]} />

Maximum number of blocks in multipart upload for Azure.

<h2 id="azure_max_get_burst">
  azure\_max\_get\_burst
</h2>

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

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

Max number of requests that can be issued simultaneously before hitting request per second limit. By default (0) equals to `azure_max_get_rps`

<h2 id="azure_max_get_rps">
  azure\_max\_get\_rps
</h2>

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

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

Limit on Azure GET request per second rate before throttling. Zero means unlimited.

<h2 id="azure_max_inflight_parts_for_one_file">
  azure\_max\_inflight\_parts\_for\_one\_file
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "20"},{"label": "The maximum number of a concurrent loaded parts in multipart upload request. 0 means unlimited."}]}]} />

The maximum number of a concurrent loaded parts in multipart upload request. 0 means unlimited.

<h2 id="azure_max_put_burst">
  azure\_max\_put\_burst
</h2>

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

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

Max number of requests that can be issued simultaneously before hitting request per second limit. By default (0) equals to `azure_max_put_rps`

<h2 id="azure_max_put_rps">
  azure\_max\_put\_rps
</h2>

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

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

Limit on Azure PUT request per second rate before throttling. Zero means unlimited.

<h2 id="azure_max_redirects">
  azure\_max\_redirects
</h2>

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

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

Max number of azure redirects hops allowed.

<h2 id="azure_max_single_part_copy_size">
  azure\_max\_single\_part\_copy\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "268435456"},{"label": "The maximum size of object to copy using single part copy to Azure blob storage."}]}]} />

The maximum size of object to copy using single part copy to Azure blob storage.

<h2 id="azure_max_single_part_upload_size">
  azure\_max\_single\_part\_upload\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "33554432"},{"label": "Align with S3"}]}]} />

The maximum size of object to upload using singlepart upload to Azure blob storage.

<h2 id="azure_max_single_read_retries">
  azure\_max\_single\_read\_retries
</h2>

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

The maximum number of retries during single Azure blob storage read.

<h2 id="azure_max_unexpected_write_error_retries">
  azure\_max\_unexpected\_write\_error\_retries
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "4"},{"label": "The maximum number of retries in case of unexpected errors during Azure blob storage write"}]}]} />

The maximum number of retries in case of unexpected errors during Azure blob storage write

<h2 id="azure_max_upload_part_size">
  azure\_max\_upload\_part\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "5368709120"},{"label": "The maximum size of part to upload during multipart upload to Azure blob storage."}]}]} />

The maximum size of part to upload during multipart upload to Azure blob storage.

<h2 id="azure_min_upload_part_size">
  azure\_min\_upload\_part\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "16777216"},{"label": "The minimum size of part to upload during multipart upload to Azure blob storage."}]}]} />

The minimum size of part to upload during multipart upload to Azure blob storage.

<h2 id="azure_request_timeout_ms">
  azure\_request\_timeout\_ms
</h2>

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

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

Idleness timeout for sending and receiving data to/from azure. Fail if a single TCP read or write call blocks for this long.

<h2 id="azure_sdk_max_retries">
  azure\_sdk\_max\_retries
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "10"},{"label": "Maximum number of retries in azure sdk"}]}]} />

Maximum number of retries in azure sdk

<h2 id="azure_sdk_retry_initial_backoff_ms">
  azure\_sdk\_retry\_initial\_backoff\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "10"},{"label": "Minimal backoff between retries in azure sdk"}]}]} />

Minimal backoff between retries in azure sdk

<h2 id="azure_sdk_retry_max_backoff_ms">
  azure\_sdk\_retry\_max\_backoff\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "1000"},{"label": "Maximal backoff between retries in azure sdk"}]}]} />

Maximal backoff between retries in azure sdk

<h2 id="azure_skip_empty_files">
  azure\_skip\_empty\_files
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "Allow to skip empty files in azure table engine"}]}]} />

Enables or disables skipping empty files in S3 engine.

Possible values:

* 0 — `SELECT` throws an exception if empty file is not compatible with requested format.
* 1 — `SELECT` returns empty result for empty file.

<h2 id="azure_strict_upload_part_size">
  azure\_strict\_upload\_part\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "The exact size of part to upload during multipart upload to Azure blob storage."}]}]} />

The exact size of part to upload during multipart upload to Azure blob storage.

<h2 id="azure_throw_on_zero_files_match">
  azure\_throw\_on\_zero\_files\_match
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "Allow to throw an error when ListObjects request cannot match any files in AzureBlobStorage engine instead of empty query result"}]}]} />

Throw an error if matched zero files according to glob expansion rules.

Possible values:

* 1 — `SELECT` throws an exception.
* 0 — `SELECT` returns empty result.

<h2 id="azure_truncate_on_insert">
  azure\_truncate\_on\_insert
</h2>

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

Enables or disables truncate before insert in azure engine tables.

<h2 id="azure_upload_part_size_multiply_factor">
  azure\_upload\_part\_size\_multiply\_factor
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "2"},{"label": "Multiply azure_min_upload_part_size by this factor each time azure_multiply_parts_count_threshold parts were uploaded from a single write to Azure blob storage."}]}]} />

Multiply azure\_min\_upload\_part\_size by this factor each time azure\_multiply\_parts\_count\_threshold parts were uploaded from a single write to Azure blob storage.

<h2 id="azure_upload_part_size_multiply_parts_count_threshold">
  azure\_upload\_part\_size\_multiply\_parts\_count\_threshold
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "500"},{"label": "Each time this number of parts was uploaded to Azure blob storage, azure_min_upload_part_size is multiplied by azure_upload_part_size_multiply_factor."}]}]} />

Each time this number of parts was uploaded to Azure blob storage, azure\_min\_upload\_part\_size is multiplied by azure\_upload\_part\_size\_multiply\_factor.

<h2 id="azure_use_adaptive_timeouts">
  azure\_use\_adaptive\_timeouts
</h2>

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

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

When set to `true` than for all azure requests first two attempts are made with low send and receive timeouts.
When set to `false` than all attempts are made with identical timeouts.

<h2 id="backup_restore_batch_size_for_keeper_multi">
  backup\_restore\_batch\_size\_for\_keeper\_multi
</h2>

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

Maximum size of batch for multi request to \[Zoo]Keeper during backup or restore

<h2 id="backup_restore_batch_size_for_keeper_multiread">
  backup\_restore\_batch\_size\_for\_keeper\_multiread
</h2>

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

Maximum size of batch for multiread request to \[Zoo]Keeper during backup or restore

<h2 id="backup_restore_failure_after_host_disconnected_for_seconds">
  backup\_restore\_failure\_after\_host\_disconnected\_for\_seconds
</h2>

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

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

If a host during a BACKUP ON CLUSTER or RESTORE ON CLUSTER operation doesn't recreate its ephemeral 'alive' node in ZooKeeper for this amount of time then the whole backup or restore is considered as failed.
This value should be bigger than any reasonable time for a host to reconnect to ZooKeeper after a failure.
Zero means unlimited.

<h2 id="backup_restore_finish_timeout_after_error_sec">
  backup\_restore\_finish\_timeout\_after\_error\_sec
</h2>

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

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

How long the initiator should wait for other host to react to the 'error' node and stop their work on the current BACKUP ON CLUSTER or RESTORE ON CLUSTER operation.

<h2 id="backup_restore_keeper_fault_injection_probability">
  backup\_restore\_keeper\_fault\_injection\_probability
</h2>

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

Approximate probability of failure for a keeper request during backup or restore. Valid value is in interval \[0.0f, 1.0f]

<h2 id="backup_restore_keeper_fault_injection_seed">
  backup\_restore\_keeper\_fault\_injection\_seed
</h2>

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

0 - random seed, otherwise the setting value

<h2 id="backup_restore_keeper_max_retries">
  backup\_restore\_keeper\_max\_retries
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "1000"},{"label": "Should be big enough so the whole operation BACKUP or RESTORE operation won't fail because of a temporary [Zoo]Keeper failure in the middle of it."}]}, {"id": "row-2","items": [{"label": "24.10"},{"label": "1000"},{"label": "Should be big enough so the whole operation BACKUP or RESTORE operation won't fail because of a temporary [Zoo]Keeper failure in the middle of it."}]}]} />

Max retries for \[Zoo]Keeper operations in the middle of a BACKUP or RESTORE operation.
Should be big enough so the whole operation won't fail because of a temporary \[Zoo]Keeper failure.

<h2 id="backup_restore_keeper_max_retries_while_handling_error">
  backup\_restore\_keeper\_max\_retries\_while\_handling\_error
</h2>

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

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

Max retries for \[Zoo]Keeper operations while handling an error of a BACKUP ON CLUSTER or RESTORE ON CLUSTER operation.

<h2 id="backup_restore_keeper_max_retries_while_initializing">
  backup\_restore\_keeper\_max\_retries\_while\_initializing
</h2>

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

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

Max retries for \[Zoo]Keeper operations during the initialization of a BACKUP ON CLUSTER or RESTORE ON CLUSTER operation.

<h2 id="backup_restore_keeper_retry_initial_backoff_ms">
  backup\_restore\_keeper\_retry\_initial\_backoff\_ms
</h2>

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

Initial backoff timeout for \[Zoo]Keeper operations during backup or restore

<h2 id="backup_restore_keeper_retry_max_backoff_ms">
  backup\_restore\_keeper\_retry\_max\_backoff\_ms
</h2>

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

Max backoff timeout for \[Zoo]Keeper operations during backup or restore

Cloud default value: `60000`.

<h2 id="backup_restore_keeper_value_max_size">
  backup\_restore\_keeper\_value\_max\_size
</h2>

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

Maximum size of data of a \[Zoo]Keeper's node during backup

<h2 id="backup_restore_s3_retry_attempts">
  backup\_restore\_s3\_retry\_attempts
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "1000"},{"label": "Setting for Aws::Client::RetryStrategy, Aws::Client does retries itself, 0 means no retries. It takes place only for backup/restore."}]}]} />

Setting for Aws::Client::RetryStrategy, Aws::Client does retries itself, 0 means no retries. It takes place only for backup/restore.

<h2 id="backup_restore_s3_retry_initial_backoff_ms">
  backup\_restore\_s3\_retry\_initial\_backoff\_ms
</h2>

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

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

Initial backoff delay in milliseconds before the first retry attempt during backup and restore. Each subsequent retry increases the delay exponentially, up to the maximum specified by `backup_restore_s3_retry_max_backoff_ms`

<h2 id="backup_restore_s3_retry_jitter_factor">
  backup\_restore\_s3\_retry\_jitter\_factor
</h2>

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

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

Jitter factor applied to the retry backoff delay in Aws::Client::RetryStrategy during backup and restore operations. The computed backoff delay is multiplied by a random factor in the range \[1.0, 1.0 + jitter], up to the maximum `backup_restore_s3_retry_max_backoff_ms`. Must be in \[0.0, 1.0] interval

<h2 id="backup_restore_s3_retry_max_backoff_ms">
  backup\_restore\_s3\_retry\_max\_backoff\_ms
</h2>

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

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

Maximum delay in milliseconds between retries during backup and restore operations.

<h2 id="backup_slow_all_threads_after_retryable_s3_error">
  backup\_slow\_all\_threads\_after\_retryable\_s3\_error
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "0"},{"label": "New setting"}]}, {"id": "row-2","items": [{"label": "25.6"},{"label": "0"},{"label": "New setting"}]}, {"id": "row-3","items": [{"label": "25.10"},{"label": "0"},{"label": "Disable the setting by default"}]}]} />

When set to `true`, all threads executing S3 requests to the same backup endpoint are slowed down
after any single S3 request encounters a retryable S3 error, such as 'Slow Down'.
When set to `false`, each thread handles s3 request backoff independently of the others.

<h2 id="cache_warmer_threads">
  cache\_warmer\_threads
</h2>

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

Only has an effect in ClickHouse Cloud. Number of background threads for speculatively downloading new data parts into the filesystem cache, when [cache\_populated\_by\_fetch](/reference/settings/merge-tree-settings#cache_populated_by_fetch) is enabled. Zero to disable.

<h2 id="calculate_text_stack_trace">
  calculate\_text\_stack\_trace
</h2>

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

Calculate text stack trace in case of exceptions during query execution. This is the default. It requires symbol lookups that may slow down fuzzing tests when a huge amount of wrong queries are executed. In normal cases, you should not disable this option.

<h2 id="cancel_http_readonly_queries_on_client_close">
  cancel\_http\_readonly\_queries\_on\_client\_close
</h2>

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

Cancels HTTP read-only queries (e.g. SELECT) when a client closes the connection without waiting for the response.

Cloud default value: `1`.

<h2 id="cast_ipv4_ipv6_default_on_conversion_error">
  cast\_ipv4\_ipv6\_default\_on\_conversion\_error
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.3"},{"label": "0"},{"label": "Make functions cast(value, 'IPv4') and cast(value, 'IPv6') behave same as toIPv4 and toIPv6 functions"}]}]} />

CAST operator into IPv4, CAST operator into IPV6 type, toIPv4, toIPv6 functions will return default value instead of throwing exception on conversion error.

<h2 id="cast_keep_nullable">
  cast\_keep\_nullable
</h2>

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

Enables or disables keeping of the `Nullable` data type in [CAST](/reference/functions/regular-functions/type-conversion-functions#CAST) operations.

When the setting is enabled and the argument of `CAST` function is `Nullable`, the result is also transformed to `Nullable` type. When the setting is disabled, the result always has the destination type exactly.

Possible values:

* 0 — The `CAST` result has exactly the destination type specified.
* 1 — If the argument type is `Nullable`, the `CAST` result is transformed to `Nullable(DestinationDataType)`.

**Examples**

The following query results in the destination data type exactly:

```sql theme={null}
SET cast_keep_nullable = 0;
SELECT CAST(toNullable(toInt32(0)) AS Int32) as x, toTypeName(x);
```

Result:

```text theme={null}
┌─x─┬─toTypeName(CAST(toNullable(toInt32(0)), 'Int32'))─┐
│ 0 │ Int32                                             │
└───┴───────────────────────────────────────────────────┘
```

The following query results in the `Nullable` modification on the destination data type:

```sql theme={null}
SET cast_keep_nullable = 1;
SELECT CAST(toNullable(toInt32(0)) AS Int32) as x, toTypeName(x);
```

Result:

```text theme={null}
┌─x─┬─toTypeName(CAST(toNullable(toInt32(0)), 'Int32'))─┐
│ 0 │ Nullable(Int32)                                   │
└───┴───────────────────────────────────────────────────┘
```

**See Also**

* [CAST](/reference/functions/regular-functions/type-conversion-functions#CAST) functio

<h2 id="cast_string_to_date_time_mode">
  cast\_string\_to\_date\_time\_mode
</h2>

<SettingsInfoBlock type="DateTimeInputFormat" default_value="best_effort" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "best_effort"},{"label": "Better usability"}]}, {"id": "row-2","items": [{"label": "25.6"},{"label": "basic"},{"label": "Allow to use different DateTime parsing mode in String to DateTime cast"}]}]} />

Allows choosing a parser of the text representation of date and time during cast from String.

Possible values:

* `'best_effort'` — Enables extended parsing.

  ClickHouse can parse the basic `YYYY-MM-DD HH:MM:SS` format and all [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time formats. For example, `'2018-06-08T01:02:03.000Z'`.

* `'best_effort_us'` — Similar to `best_effort` (see the difference in [parseDateTimeBestEffortUS](/reference/functions/regular-functions/type-conversion-functions#parseDateTimeBestEffortUS)

* `'basic'` — Use basic parser.

  ClickHouse can parse only the basic `YYYY-MM-DD HH:MM:SS` or `YYYY-MM-DD` format. For example, `2019-08-20 10:18:56` or `2019-08-20`.

See also:

* [DateTime data type.](/reference/data-types/datetime)
* [Functions for working with dates and times.](/reference/functions/regular-functions/date-time-functions)

<h2 id="cast_string_to_dynamic_use_inference">
  cast\_string\_to\_dynamic\_use\_inference
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.5"},{"label": "0"},{"label": "Add setting to allow converting String to Dynamic through parsing"}]}]} />

Use types inference during String to Dynamic conversio

<h2 id="cast_string_to_variant_use_inference">
  cast\_string\_to\_variant\_use\_inference
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "1"},{"label": "New setting to enable/disable types inference during CAST from String to Variant"}]}]} />

Use types inference during String to Variant conversion.

<h2 id="check_named_collection_dependencies">
  check\_named\_collection\_dependencies
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "New setting to check if dropping a named collection would break dependent tables."}]}]} />

Check that DROP NAMED COLLECTION will not break tables that depend on it

<h2 id="check_query_single_value_result">
  check\_query\_single\_value\_result
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "0"},{"label": "Changed setting to make CHECK TABLE more useful"}]}]} />

Defines the level of detail for the [CHECK TABLE](/reference/statements/check-table) query result for `MergeTree` family engines .

Possible values:

* 0 — the query shows a check status for every individual data part of a table.
* 1 — the query shows the general table check status.

<h2 id="check_referential_table_dependencies">
  check\_referential\_table\_dependencies
</h2>

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

Check that DDL query (such as DROP TABLE or RENAME) will not break referential dependencies

<h2 id="check_table_dependencies">
  check\_table\_dependencies
</h2>

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

Check that DDL query (such as DROP TABLE or RENAME) will not break dependencies

<h2 id="checksum_on_read">
  checksum\_on\_read
</h2>

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

Validate checksums on reading. It is enabled by default and should be always enabled in production. Please do not expect any benefits in disabling this setting. It may only be used for experiments and benchmarks. The setting is only applicable for tables of MergeTree family. Checksums are always validated for other table engines and when receiving data over the network.

<h2 id="cloud_mode">
  cloud\_mode
</h2>

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

Cloud mode

Cloud default value: `1`.

<h2 id="cloud_mode_database_engine">
  cloud\_mode\_database\_engine
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "1"},{"label": "A setting for ClickHouse Cloud"}]}]} />

The database engine allowed in Cloud. 1 - rewrite DDLs to use Replicated database, 2 - rewrite DDLs to use Shared database

Cloud default value: `2`.

<h2 id="cloud_mode_engine">
  cloud\_mode\_engine
</h2>

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

The engine family allowed in Cloud.

* 0 - allow everything
* 1 - rewrite DDLs to use \*ReplicatedMergeTree
* 2 - rewrite DDLs to use SharedMergeTree
* 3 - rewrite DDLs to use SharedMergeTree except when explicitly passed remote disk is specified
* 4 - same as 3, plus additionally use Alias instead of Distributed (the Alias table will point to the destination table of the Distributed table, so it will use the corresponding local table)

UInt64 to minimize public part

Cloud default value: `2`.

<h2 id="cluster_for_parallel_replicas">
  cluster\_for\_parallel\_replicas
</h2>

Cluster for a shard in which current server is located

Cloud default value: `default`.

<h2 id="cluster_function_process_archive_on_multiple_nodes">
  cluster\_function\_process\_archive\_on\_multiple\_nodes
</h2>

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

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

If set to `true`, increases performance of processing archives in cluster functions. Should be set to `false` for compatibility and to avoid errors during upgrade to 25.7+ if using cluster functions with archives on earlier versions.

<h2 id="cluster_table_function_buckets_batch_size">
  cluster\_table\_function\_buckets\_batch\_size
</h2>

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

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

Defines the approximate size of a batch (in bytes) used in distributed processing of tasks in cluster table functions with `bucket` split granularity. The system accumulates data until at least this amount is reached. The actual size may be slightly larger to align with data boundaries.

<h2 id="cluster_table_function_split_granularity">
  cluster\_table\_function\_split\_granularity
</h2>

<SettingsInfoBlock type="ObjectStorageGranularityLevel" default_value="file" />

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

Controls how data is split into tasks when executing a CLUSTER TABLE FUNCTION.

This setting defines the granularity of work distribution across the cluster:

* `file` — each task processes an entire file.
* `bucket` — tasks are created per internal data block within a file (for example, Parquet row groups).

Choosing finer granularity (like `bucket`) can improve parallelism when working with a small number of large files.
For instance, if a Parquet file contains multiple row groups, enabling `bucket` granularity allows each group to be processed independently by different workers.

<h2 id="collect_hash_table_stats_during_aggregation">
  collect\_hash\_table\_stats\_during\_aggregation
</h2>

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

Enable collecting hash table statistics to optimize memory allocatio

<h2 id="collect_hash_table_stats_during_joins">
  collect\_hash\_table\_stats\_during\_joins
</h2>

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

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

Enable collecting hash table statistics to optimize memory allocatio

<h2 id="compatibility">
  compatibility
</h2>

The `compatibility` setting causes ClickHouse to use the default settings of a previous version of ClickHouse, where the previous version is provided as the setting.

If settings are set to non-default values, then those settings are honored (only settings that have not been modified are affected by the `compatibility` setting).

This setting takes a ClickHouse version number as a string, like `22.3`, `22.8`. An empty value means that this setting is disabled.

Disabled by default.

<Note>
  In ClickHouse Cloud, the service-level default compatibility setting must be set by ClickHouse Cloud support. Please [open a case](https://clickhouse.cloud/support) to have it set.
  However, the compatibility setting can be overridden at the user, role, profile, query, or session level using standard ClickHouse setting mechanisms such as `SET compatibility = '22.3'` in a session or `SETTINGS compatibility = '22.3'` in a query.
</Note>

<h2 id="compatibility_ignore_auto_increment_in_create_table">
  compatibility\_ignore\_auto\_increment\_in\_create\_table
</h2>

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

Ignore AUTO\_INCREMENT keyword in column declaration if true, otherwise return error. It simplifies migration from MySQL

<h2 id="compatibility_ignore_collation_in_create_table">
  compatibility\_ignore\_collation\_in\_create\_table
</h2>

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

Compatibility ignore collation in create table

<h2 id="compatibility_s3_presigned_url_query_in_path">
  compatibility\_s3\_presigned\_url\_query\_in\_path
</h2>

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

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

Compatibility: when enabled, folds pre-signed URL query parameters (e.g. X-Amz-\*) into the S3 key (legacy behavior),
so '?' acts as a wildcard in the path. When disabled (default), pre-signed URL query parameters are kept in the URL query
to avoid interpreting '?' as a wildcard.

<h2 id="compile_aggregate_expressions">
  compile\_aggregate\_expressions
</h2>

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

Enables or disables JIT-compilation of aggregate functions to native code. Enabling this setting can improve the performance.

Possible values:

* 0 — Aggregation is done without JIT compilation.
* 1 — Aggregation is done using JIT compilation.

**See Also**

* [min\_count\_to\_compile\_aggregate\_expression](#min_count_to_compile_aggregate_expression)

<h2 id="compile_expressions">
  compile\_expressions
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "1"},{"label": "We believe that the LLVM infrastructure behind the JIT compiler is stable enough to enable this setting by default."}]}]} />

Compile some scalar functions and operators to native code.

<h2 id="compile_sort_description">
  compile\_sort\_description
</h2>

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

Compile sort description to native code.

<h2 id="connect_timeout">
  connect\_timeout
</h2>

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

Connection timeout if there are no replicas.

<h2 id="connect_timeout_with_failover_ms">
  connect\_timeout\_with\_failover\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.4"},{"label": "1000"},{"label": "Increase default connect timeout because of async connect"}]}]} />

The timeout in milliseconds for connecting to a remote server for a Distributed table engine, if the 'shard' and 'replica' sections are used in the cluster definition.
If unsuccessful, several attempts are made to connect to various replicas.

<h2 id="connect_timeout_with_failover_secure_ms">
  connect\_timeout\_with\_failover\_secure\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.4"},{"label": "1000"},{"label": "Increase default secure connect timeout because of async connect"}]}]} />

Connection timeout for selecting first healthy replica (for secure connections).

<h2 id="connection_pool_max_wait_ms">
  connection\_pool\_max\_wait\_ms
</h2>

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

The wait time in milliseconds for a connection when the connection pool is full.

Possible values:

* Positive integer.
* 0 — Infinite timeout.

<h2 id="connections_with_failover_max_tries">
  connections\_with\_failover\_max\_tries
</h2>

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

The maximum number of connection attempts with each replica for the Distributed table engine.

<h2 id="convert_query_to_cnf">
  convert\_query\_to\_cnf
</h2>

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

When set to `true`, a `SELECT` query will be converted to conjuctive normal form (CNF). There are scenarios where rewriting a query in CNF may execute faster (view this [Github issue](https://github.com/ClickHouse/ClickHouse/issues/11749) for an explanation).

For example, notice how the following `SELECT` query is not modified (the default behavior):

```sql theme={null}
EXPLAIN SYNTAX
SELECT *
FROM
(
    SELECT number AS x
    FROM numbers(20)
) AS a
WHERE ((x >= 1) AND (x <= 5)) OR ((x >= 10) AND (x <= 15))
SETTINGS convert_query_to_cnf = false;
```

The result is:

```response theme={null}
┌─explain────────────────────────────────────────────────────────┐
│ SELECT x                                                       │
│ FROM                                                           │
│ (                                                              │
│     SELECT number AS x                                         │
│     FROM numbers(20)                                           │
│     WHERE ((x >= 1) AND (x <= 5)) OR ((x >= 10) AND (x <= 15)) │
│ ) AS a                                                         │
│ WHERE ((x >= 1) AND (x <= 5)) OR ((x >= 10) AND (x <= 15))     │
│ SETTINGS convert_query_to_cnf = 0                              │
└────────────────────────────────────────────────────────────────┘
```

Let's set `convert_query_to_cnf` to `true` and see what changes:

```sql theme={null}
EXPLAIN SYNTAX
SELECT *
FROM
(
    SELECT number AS x
    FROM numbers(20)
) AS a
WHERE ((x >= 1) AND (x <= 5)) OR ((x >= 10) AND (x <= 15))
SETTINGS convert_query_to_cnf = true;
```

Notice the `WHERE` clause is rewritten in CNF, but the result set is the identical - the Boolean logic is unchanged:

```response theme={null}
┌─explain───────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ SELECT x                                                                                                              │
│ FROM                                                                                                                  │
│ (                                                                                                                     │
│     SELECT number AS x                                                                                                │
│     FROM numbers(20)                                                                                                  │
│     WHERE ((x <= 15) OR (x <= 5)) AND ((x <= 15) OR (x >= 1)) AND ((x >= 10) OR (x <= 5)) AND ((x >= 10) OR (x >= 1)) │
│ ) AS a                                                                                                                │
│ WHERE ((x >= 10) OR (x >= 1)) AND ((x >= 10) OR (x <= 5)) AND ((x <= 15) OR (x >= 1)) AND ((x <= 15) OR (x <= 5))     │
│ SETTINGS convert_query_to_cnf = 1                                                                                     │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

Possible values: true, false

<h2 id="correlated_subqueries_default_join_kind">
  correlated\_subqueries\_default\_join\_kind
</h2>

<SettingsInfoBlock type="DecorrelationJoinKind" default_value="right" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "right"},{"label": "New setting. Default join kind for decorrelated query plan."}]}, {"id": "row-2","items": [{"label": "25.10"},{"label": "right"},{"label": "New setting. Default join kind for decorrelated query plan."}]}]} />

Controls the kind of joins in the decorrelated query plan. The default value is `right`, which means that decorrelated plan will contain RIGHT JOINs with subquery input on the right side.

Possible values:

* `left` - Decorrelation process will produce LEFT JOINs and input table will appear on the left side.
* `right` - Decorrelation process will produce RIGHT JOINs and input table will appear on the right side.

<h2 id="correlated_subqueries_substitute_equivalent_expressions">
  correlated\_subqueries\_substitute\_equivalent\_expressions
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "1"},{"label": "New setting to correlated subquery planning optimization."}]}]} />

Use filter expressions to inference equivalent expressions and substitute them instead of creating a CROSS JOIN.

<h2 id="correlated_subqueries_use_in_memory_buffer">
  correlated\_subqueries\_use\_in\_memory\_buffer
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "1"},{"label": "Use in-memory buffer for input of correlated subqueries by default."}]}]} />

Use in-memory buffer for correlated subquery input to avoid its repeated evaluation.

<h2 id="count_distinct_implementation">
  count\_distinct\_implementation
</h2>

<SettingsInfoBlock type="String" default_value="uniqExact" />

Specifies which of the `uniq*` functions should be used to perform the [COUNT(DISTINCT ...)](/reference/functions/aggregate-functions/count) construction.

Possible values:

* [uniq](/reference/functions/aggregate-functions/uniq)
* [uniqCombined](/reference/functions/aggregate-functions/uniqCombined)
* [uniqCombined64](/reference/functions/aggregate-functions/uniqCombined64)
* [uniqHLL12](/reference/functions/aggregate-functions/uniqHLL12)
* [uniqExact](/reference/functions/aggregate-functions/uniqExact)

<h2 id="count_distinct_optimization">
  count\_distinct\_optimization
</h2>

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

Rewrite count distinct to subquery of group by

<h2 id="count_matches_stop_at_empty_match">
  count\_matches\_stop\_at\_empty\_match
</h2>

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

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

Stop counting once a pattern matches zero-length in the `countMatches` function.

<h2 id="create_if_not_exists">
  create\_if\_not\_exists
</h2>

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

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

Enable `IF NOT EXISTS` for `CREATE` statement by default. If either this setting or `IF NOT EXISTS` is specified and a table with the provided name already exists, no exception will be thrown.

<h2 id="create_index_ignore_unique">
  create\_index\_ignore\_unique
</h2>

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

Ignore UNIQUE keyword in CREATE UNIQUE INDEX. Made for SQL compatibility tests.

<h2 id="create_replicated_merge_tree_fault_injection_probability">
  create\_replicated\_merge\_tree\_fault\_injection\_probability
</h2>

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

The probability of a fault injection during table creation after creating metadata in ZooKeeper

<h2 id="create_table_empty_primary_key_by_default">
  create\_table\_empty\_primary\_key\_by\_default
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1"},{"label": "Better usability"}]}]} />

Allow to create \*MergeTree tables with empty primary key when ORDER BY and PRIMARY KEY not specified

<h2 id="cross_join_min_bytes_to_compress">
  cross\_join\_min\_bytes\_to\_compress
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.5"},{"label": "1073741824"},{"label": "Minimal size of block to compress in CROSS JOIN. Zero value means - disable this threshold. This block is compressed when any of the two thresholds (by rows or by bytes) are reached."}]}]} />

Minimal size of block to compress in CROSS JOIN. Zero value means - disable this threshold. This block is compressed when any of the two thresholds (by rows or by bytes) are reached.

<h2 id="cross_join_min_rows_to_compress">
  cross\_join\_min\_rows\_to\_compress
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.5"},{"label": "10000000"},{"label": "Minimal count of rows to compress block in CROSS JOIN. Zero value means - disable this threshold. This block is compressed when any of the two thresholds (by rows or by bytes) are reached."}]}]} />

Minimal count of rows to compress block in CROSS JOIN. Zero value means - disable this threshold. This block is compressed when any of the two thresholds (by rows or by bytes) are reached.

<h2 id="cross_to_inner_join_rewrite">
  cross\_to\_inner\_join\_rewrite
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.7"},{"label": "2"},{"label": "Force rewrite comma join to inner"}]}]} />

Use inner join instead of comma/cross join if there are joining expressions in the WHERE section. Values: 0 - no rewrite, 1 - apply if possible for comma/cross, 2 - force rewrite all comma joins, cross - if possible

<h2 id="data_type_default_nullable">
  data\_type\_default\_nullable
</h2>

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

Allows data types without explicit modifiers [NULL or NOT NULL](/reference/statements/create/table#null-or-not-null-modifiers) in column definition will be [Nullable](/reference/data-types/nullable).

Possible values:

* 1 — The data types in column definitions are set to `Nullable` by default.
* 0 — The data types in column definitions are set to not `Nullable` by default.

<h2 id="database_atomic_wait_for_drop_and_detach_synchronously">
  database\_atomic\_wait\_for\_drop\_and\_detach\_synchronously
</h2>

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

Adds a modifier `SYNC` to all `DROP` and `DETACH` queries.

Possible values:

* 0 — Queries will be executed with delay.
* 1 — Queries will be executed without delay.

<h2 id="database_datalake_require_metadata_access">
  database\_datalake\_require\_metadata\_access
</h2>

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

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

Either to throw error or not if we don't have rights to get table's metadata in database engine DataLakeCatalog.

<h2 id="database_replicated_allow_explicit_uuid">
  database\_replicated\_allow\_explicit\_uuid
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "0"},{"label": "Added a new setting to disallow explicitly specifying table UUID"}]}]} />

0 - Don't allow to explicitly specify UUIDs for tables in Replicated databases. 1 - Allow. 2 - Allow, but ignore the specified UUID and generate a random one instead.

<h2 id="database_replicated_allow_heavy_create">
  database\_replicated\_allow\_heavy\_create
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "0"},{"label": "Long-running DDL queries (CREATE AS SELECT and POPULATE) for Replicated database engine was forbidden"}]}]} />

Allow long-running DDL queries (CREATE AS SELECT and POPULATE) in Replicated database engine. Note that it can block DDL queue for a long time.

<h2 id="database_replicated_allow_only_replicated_engine">
  database\_replicated\_allow\_only\_replicated\_engine
</h2>

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

Allow to create only Replicated tables in database with engine Replicated

Cloud default value: `1`.

<h2 id="database_replicated_allow_replicated_engine_arguments">
  database\_replicated\_allow\_replicated\_engine\_arguments
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "0"},{"label": "Don't allow explicit arguments by default"}]}]} />

0 - Don't allow to explicitly specify ZooKeeper path and replica name for \*MergeTree tables in Replicated databases. 1 - Allow. 2 - Allow, but ignore the specified path and use default one instead. 3 - Allow and don't log a warning.

<h2 id="database_replicated_always_detach_permanently">
  database\_replicated\_always\_detach\_permanently
</h2>

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

Execute DETACH TABLE as DETACH TABLE PERMANENTLY if database engine is Replicated

<h2 id="database_replicated_enforce_synchronous_settings">
  database\_replicated\_enforce\_synchronous\_settings
</h2>

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

Enforces synchronous waiting for some queries (see also database\_atomic\_wait\_for\_drop\_and\_detach\_synchronously, mutations\_sync, alter\_sync). Not recommended to enable these settings.

<h2 id="database_replicated_initial_query_timeout_sec">
  database\_replicated\_initial\_query\_timeout\_sec
</h2>

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

Sets how long initial DDL query should wait for Replicated database to process previous DDL queue entries in seconds.

Possible values:

* Positive integer.
* 0 — Unlimited.

<h2 id="database_shared_drop_table_delay_seconds">
  database\_shared\_drop\_table\_delay\_seconds
</h2>

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

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

The delay in seconds before a dropped table is actually removed from a Shared database. This allows to recover the table within this time using `UNDROP TABLE` statement.

<h2 id="decimal_check_overflow">
  decimal\_check\_overflow
</h2>

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

Check overflow of decimal arithmetic/comparison operations

<h2 id="deduplicate_blocks_in_dependent_materialized_views">
  deduplicate\_blocks\_in\_dependent\_materialized\_views
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "Enable deduplication for dependent materialized views by default."}]}]} />

Enables or disables the deduplication check for materialized views that receive data from Replicated\* tables.

Possible values:

0 — Disabled.
1 — Enabled.

When enabled, ClickHouse performs deduplication of blocks in materialized views that depend on Replicated\* tables.
This setting is useful for ensuring that materialized views do not contain duplicate data when the insertion operation is being retried due to a failure.

**See Also**

* [NULL Processing in IN Operators](/concepts/features/operations/insert/deduplicating-inserts-on-retries#insert-deduplication-with-materialized-views)

<h2 id="deduplicate_insert">
  deduplicate\_insert
</h2>

<SettingsInfoBlock type="DeduplicateInsertMode" default_value="enable" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "enable"},{"label": "Enable deduplication for all sync and async inserts by default."}]}]} />

Enables or disables block deduplication of  `INSERT INTO` (for Replicated\* tables).
The setting overrides `insert_deduplicate` and `async_insert_deduplicate` settings.
That setting has three possible values:

* disable — Deduplication is disabled for `INSERT INTO` query.
* enable — Deduplication is enabled for `INSERT INTO` query.
* backward\_compatible\_choice — Deduplication is enabled if `insert_deduplicate` or `async_insert_deduplicate` are enabled for specific insert type.

<h2 id="deduplicate_insert_select">
  deduplicate\_insert\_select
</h2>

<SettingsInfoBlock type="DeduplicateInsertSelectMode" default_value="enable_when_possible" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "enable_when_possible"},{"label": "change the default behavior of deduplicate_insert_select to ENABLE_WHEN_POSSIBLE"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "enable_even_for_bad_queries"},{"label": "New setting, replace insert_select_deduplicate"}]}]} />

Enables or disables block deduplication of `INSERT SELECT` (for Replicated\* tables).
The setting overrids `insert_deduplicate` and `deduplicate_insert` for `INSERT SELECT` queries.
That setting has four possible values:

* disable — Deduplication is disabled for `INSERT SELECT` query.
* force\_enable — Deduplication is enabled for `INSERT SELECT` query. If select result is not stable, exception is thrown.
* enable\_when\_possible — Deduplication is enabled if `insert_deduplicate` is enable and select result is stable, otherwise disabled.
* enable\_even\_for\_bad\_queries - Deduplication is enabled if `insert_deduplicate` is enable. If select result is not stable, warning is logged, but query is executed with deduplication. This option is for backward compatibility. Consider to use other options instead as it may lead to unexpected results.

<h2 id="default_materialized_view_sql_security">
  default\_materialized\_view\_sql\_security
</h2>

<SettingsInfoBlock type="SQLSecurityType" default_value="DEFINER" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "DEFINER"},{"label": "Allows to set a default value for SQL SECURITY option when creating a materialized view"}]}]} />

Allows to set a default value for SQL SECURITY option when creating a materialized view. [More about SQL security](/reference/statements/create/view#sql_security).

The default value is `DEFINER`.

<h2 id="default_max_bytes_in_join">
  default\_max\_bytes\_in\_join
</h2>

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

Maximum size of right-side table if limit is required but `max_bytes_in_join` is not set.

<h2 id="default_normal_view_sql_security">
  default\_normal\_view\_sql\_security
</h2>

<SettingsInfoBlock type="SQLSecurityType" default_value="INVOKER" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "INVOKER"},{"label": "Allows to set default `SQL SECURITY` option while creating a normal view"}]}]} />

Allows to set default `SQL SECURITY` option while creating a normal view. [More about SQL security](/reference/statements/create/view#sql_security).

The default value is `INVOKER`.

<h2 id="default_table_engine">
  default\_table\_engine
</h2>

<SettingsInfoBlock type="DefaultTableEngine" default_value="MergeTree" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "MergeTree"},{"label": "Set default table engine to MergeTree for better usability"}]}]} />

Default table engine to use when `ENGINE` is not set in a `CREATE` statement.

Possible values:

* a string representing any valid table engine name

Cloud default value: `SharedMergeTree`.

**Example**

Query:

```sql theme={null}
SET default_table_engine = 'Log';

SELECT name, value, changed FROM system.settings WHERE name = 'default_table_engine';
```

Result:

```response theme={null}
┌─name─────────────────┬─value─┬─changed─┐
│ default_table_engine │ Log   │       1 │
└──────────────────────┴───────┴─────────┘
```

In this example, any new table that does not specify an `Engine` will use the `Log` table engine:

Query:

```sql theme={null}
CREATE TABLE my_table (
    x UInt32,
    y UInt32
);

SHOW CREATE TABLE my_table;
```

Result:

```response theme={null}
┌─statement────────────────────────────────────────────────────────────────┐
│ CREATE TABLE default.my_table
(
    `x` UInt32,
    `y` UInt32
)
ENGINE = Log
└──────────────────────────────────────────────────────────────────────────┘
```

<h2 id="default_temporary_table_engine">
  default\_temporary\_table\_engine
</h2>

<SettingsInfoBlock type="DefaultTableEngine" default_value="Memory" />

Same as [default\_table\_engine](#default_table_engine) but for temporary tables.

In this example, any new temporary table that does not specify an `Engine` will use the `Log` table engine:

Query:

```sql theme={null}
SET default_temporary_table_engine = 'Log';

CREATE TEMPORARY TABLE my_table (
    x UInt32,
    y UInt32
);

SHOW CREATE TEMPORARY TABLE my_table;
```

Result:

```response theme={null}
┌─statement────────────────────────────────────────────────────────────────┐
│ CREATE TEMPORARY TABLE default.my_table
(
    `x` UInt32,
    `y` UInt32
)
ENGINE = Log
└──────────────────────────────────────────────────────────────────────────┘
```

<h2 id="default_view_definer">
  default\_view\_definer
</h2>

<SettingsInfoBlock type="String" default_value="CURRENT_USER" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "CURRENT_USER"},{"label": "Allows to set default `DEFINER` option while creating a view"}]}]} />

Allows to set default `DEFINER` option while creating a view. [More about SQL security](/reference/statements/create/view#sql_security).

The default value is `CURRENT_USER`.

<h2 id="defer_partition_pruning_after_final">
  defer\_partition\_pruning\_after\_final
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1"},{"label": "Setting newly added in 26.5 to gate the FINAL partition-pruning behavior that shipped silently in 26.3 (https://github.com/ClickHouse/ClickHouse/pull/98242). The meaningful semantic change is registered under the 26.3 block so `compatibility = '26.2'` reverts it; this entry exists so the upgrade-from-26.4 check accepts the newly-introduced name."}]}, {"id": "row-2","items": [{"label": "26.3"},{"label": "1"},{"label": "Gates the FINAL planner's unconditional skipping of partition pruning when the partition-key column is not in the sorting key. The behavior change itself shipped silently in 26.3 via https://github.com/ClickHouse/ClickHouse/pull/98242; this entry retroactively documents it so `compatibility = '26.2'` restores the pre-regression behavior (0 = prune before FINAL, fast; 1 = defer pruning, correctness-safe)."}]}]} />

When enabled (default), partition pruning is skipped for `FINAL` queries on tables whose
partition-key columns are not part of the sorting key. This is the correctness-safe behavior
introduced in 26.3: `FINAL` may need to deduplicate rows that share a primary key but live
in different partitions, and partition pruning would silently exclude such rows from the
deduplication input.

When disabled, partition pruning is applied even with `FINAL`, restoring the pre-26.3
behavior. This can be substantially faster for queries with `WHERE` predicates on the
partition column, but is only correct when rows with the same primary key cannot exist
in different partitions — e.g. event-log tables whose partition column is set at insert
time and never changes.

This setting only affects partitioned tables whose partition-key columns are not contained
in the sorting key; for other tables partition pruning is always applied.

Possible values:

* 0 — Apply partition pruning before `FINAL` (pre-26.3 behavior, faster but unsafe in the general case).
* 1 — Defer partition pruning to after `FINAL` (default, correctness-safe).

<h2 id="delta_lake_enable_engine_predicate">
  delta\_lake\_enable\_engine\_predicate
</h2>

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

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

Enables delta-kernel internal data pruning.

<h2 id="delta_lake_enable_expression_visitor_logging">
  delta\_lake\_enable\_expression\_visitor\_logging
</h2>

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

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

Enables Test level logs of DeltaLake expression visitor. These logs can be too verbose even for test logging.

<h2 id="delta_lake_insert_max_bytes_in_data_file">
  delta\_lake\_insert\_max\_bytes\_in\_data\_file
</h2>

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

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

Defines a bytes limit for a single inserted data file in delta lake.

<h2 id="delta_lake_insert_max_rows_in_data_file">
  delta\_lake\_insert\_max\_rows\_in\_data\_file
</h2>

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

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

Defines a rows limit for a single inserted data file in delta lake.

<h2 id="delta_lake_log_metadata">
  delta\_lake\_log\_metadata
</h2>

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

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

Enables logging delta lake metadata files into system table.

<h2 id="delta_lake_reload_schema_for_consistency">
  delta\_lake\_reload\_schema\_for\_consistency
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "New setting to control whether DeltaLake reloads schema before each query for consistency."}]}]} />

If enabled, schema is reloaded from the DeltaLake metadata before each query execution to ensure
consistency between the schema used during query analysis and the schema used during execution.

<h2 id="delta_lake_snapshot_end_version">
  delta\_lake\_snapshot\_end\_version
</h2>

<SettingsInfoBlock type="Int64" default_value="-1" />

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

End version of delta lake snapshot to read. Value -1 means to read latest version (value 0 is a valid snapshot version).

<h2 id="delta_lake_snapshot_start_version">
  delta\_lake\_snapshot\_start\_version
</h2>

<SettingsInfoBlock type="Int64" default_value="-1" />

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

Start version of delta lake snapshot to read. Value -1 means to read latest version (value 0 is a valid snapshot version).

<h2 id="delta_lake_snapshot_version">
  delta\_lake\_snapshot\_version
</h2>

<SettingsInfoBlock type="Int64" default_value="-1" />

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

Version of delta lake snapshot to read. Value -1 means to read latest version (value 0 is a valid snapshot version).

<h2 id="delta_lake_throw_on_engine_predicate_error">
  delta\_lake\_throw\_on\_engine\_predicate\_error
</h2>

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

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

Enables throwing an exception if there was an error when analyzing scan predicate in delta-kernel.

<h2 id="describe_compact_output">
  describe\_compact\_output
</h2>

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

If true, include only column names and types into result of DESCRIBE query

<h2 id="describe_include_subcolumns">
  describe\_include\_subcolumns
</h2>

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

Enables describing subcolumns for a [DESCRIBE](/reference/statements/describe-table) query. For example, members of a [Tuple](/reference/data-types/tuple) or subcolumns of a [Map](/reference/data-types/map#reading-subcolumns-of-map), [Nullable](/reference/data-types/nullable#finding-null) or an [Array](/reference/data-types/array#array-size) data type.

Possible values:

* 0 — Subcolumns are not included in `DESCRIBE` queries.
* 1 — Subcolumns are included in `DESCRIBE` queries.

**Example**

See an example for the [DESCRIBE](/reference/statements/describe-table) statement.

<h2 id="describe_include_virtual_columns">
  describe\_include\_virtual\_columns
</h2>

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

If true, virtual columns of table will be included into result of DESCRIBE query

<h2 id="dialect">
  dialect
</h2>

<SettingsInfoBlock type="Dialect" default_value="clickhouse" />

Which dialect will be used to parse query

<h2 id="dictionary_use_async_executor">
  dictionary\_use\_async\_executor
</h2>

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

Execute a pipeline for reading dictionary source in several threads. It's supported only by dictionaries with local CLICKHOUSE source.

<h2 id="dictionary_validate_primary_key_type">
  dictionary\_validate\_primary\_key\_type
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "0"},{"label": "Validate primary key type for dictionaries. By default id type for simple layouts will be implicitly converted to UInt64."}]}]} />

Validate primary key type for dictionaries. By default id type for simple layouts will be implicitly converted to UInt64.

<h2 id="distinct_overflow_mode">
  distinct\_overflow\_mode
</h2>

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

Sets what happens when the amount of data exceeds one of the limits.

Possible values:

* `throw`: throw an exception (default).
* `break`: stop executing the query and return the partial result, as if the
  source data ran out.

<h2 id="distributed_aggregation_memory_efficient">
  distributed\_aggregation\_memory\_efficient
</h2>

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

Is the memory-saving mode of distributed aggregation enabled.

<h2 id="distributed_background_insert_batch">
  distributed\_background\_insert\_batch
</h2>

**Aliases**: `distributed_directory_monitor_batch_inserts`

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

Enables/disables inserted data sending in batches.

When batch sending is enabled, the [Distributed](/reference/engines/table-engines/special/distributed) table engine tries to send multiple files of inserted data in one operation instead of sending them separately. Batch sending improves cluster performance by better-utilizing server and network resources.

Possible values:

* 1 — Enabled.
* 0 — Disabled.

<h2 id="distributed_background_insert_max_sleep_time_ms">
  distributed\_background\_insert\_max\_sleep\_time\_ms
</h2>

**Aliases**: `distributed_directory_monitor_max_sleep_time_ms`

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

Maximum interval for the [Distributed](/reference/engines/table-engines/special/distributed) table engine to send data. Limits exponential growth of the interval set in the [distributed\_background\_insert\_sleep\_time\_ms](#distributed_background_insert_sleep_time_ms) setting.

Possible values:

* A positive integer number of milliseconds.

<h2 id="distributed_background_insert_sleep_time_ms">
  distributed\_background\_insert\_sleep\_time\_ms
</h2>

**Aliases**: `distributed_directory_monitor_sleep_time_ms`

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

Base interval for the [Distributed](/reference/engines/table-engines/special/distributed) table engine to send data. The actual interval grows exponentially in the event of errors.

Possible values:

* A positive integer number of milliseconds.

<h2 id="distributed_background_insert_split_batch_on_failure">
  distributed\_background\_insert\_split\_batch\_on\_failure
</h2>

**Aliases**: `distributed_directory_monitor_split_batch_on_failure`

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

Enables/disables splitting batches on failures.

Sometimes sending particular batch to the remote shard may fail, because of some complex pipeline after (i.e. `MATERIALIZED VIEW` with `GROUP BY`) due to `Memory limit exceeded` or similar errors. In this case, retrying will not help (and this will stuck distributed sends for the table) but sending files from that batch one by one may succeed INSERT.

So installing this setting to `1` will disable batching for such batches (i.e. temporary disables `distributed_background_insert_batch` for failed batches).

Possible values:

* 1 — Enabled.
* 0 — Disabled.

<Note>
  This setting also affects broken batches (that may appears because of abnormal server (machine) termination and no `fsync_after_insert`/`fsync_directories` for [Distributed](/reference/engines/table-engines/special/distributed) table engine).
</Note>

<Note>
  You should not rely on automatic batch splitting, since this may hurt performance.
</Note>

<h2 id="distributed_background_insert_timeout">
  distributed\_background\_insert\_timeout
</h2>

**Aliases**: `insert_distributed_timeout`

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

Timeout for insert query into distributed. Setting is used only with insert\_distributed\_sync enabled. Zero value means no timeout.

<h2 id="distributed_cache_alignment">
  distributed\_cache\_alignment
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "0"},{"label": "Rename of distributed_cache_read_alignment"}]}]} />

Only has an effect in ClickHouse Cloud. A setting for testing purposes, do not change it

<h2 id="distributed_cache_bypass_connection_pool">
  distributed\_cache\_bypass\_connection\_pool
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "0"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Allow to bypass distributed cache connection pool

<h2 id="distributed_cache_connect_backoff_max_ms">
  distributed\_cache\_connect\_backoff\_max\_ms
</h2>

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

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

Only has an effect in ClickHouse Cloud. Maximum backoff milliseconds for distributed cache connection creation.

<h2 id="distributed_cache_connect_backoff_min_ms">
  distributed\_cache\_connect\_backoff\_min\_ms
</h2>

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

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

Only has an effect in ClickHouse Cloud. Minimum backoff milliseconds for distributed cache connection creation.

<h2 id="distributed_cache_connect_max_tries">
  distributed\_cache\_connect\_max\_tries
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "5"},{"label": "Changed setting value"}]}, {"id": "row-2","items": [{"label": "25.1"},{"label": "20"},{"label": "Cloud only"}]}, {"id": "row-3","items": [{"label": "24.10"},{"label": "20"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Number of tries to connect to distributed cache if unsuccessful

<h2 id="distributed_cache_connect_timeout_ms">
  distributed\_cache\_connect\_timeout\_ms
</h2>

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

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

Only has an effect in ClickHouse Cloud. Connection timeout when connecting to distributed cache server.

<h2 id="distributed_cache_credentials_refresh_period_seconds">
  distributed\_cache\_credentials\_refresh\_period\_seconds
</h2>

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

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

Only has an effect in ClickHouse Cloud. A period of credentials refresh.

<h2 id="distributed_cache_data_packet_ack_window">
  distributed\_cache\_data\_packet\_ack\_window
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "5"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. A window for sending ACK for DataPacket sequence in a single distributed cache read request

<h2 id="distributed_cache_discard_connection_if_unread_data">
  distributed\_cache\_discard\_connection\_if\_unread\_data
</h2>

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

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

Only has an effect in ClickHouse Cloud. Discard connection if some data is unread.

<h2 id="distributed_cache_fetch_metrics_only_from_current_az">
  distributed\_cache\_fetch\_metrics\_only\_from\_current\_az
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "1"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Fetch metrics only from current availability zone in system.distributed\_cache\_metrics, system.distributed\_cache\_events

<h2 id="distributed_cache_file_cache_name">
  distributed\_cache\_file\_cache\_name
</h2>

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

Only has an effect in ClickHouse Cloud. A setting used only for CI tests - filesystem cache name to use on distributed cache.

<h2 id="distributed_cache_log_mode">
  distributed\_cache\_log\_mode
</h2>

<SettingsInfoBlock type="DistributedCacheLogMode" default_value="on_error" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "on_error"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Mode for writing to system.distributed\_cache\_log

<h2 id="distributed_cache_max_unacked_inflight_packets">
  distributed\_cache\_max\_unacked\_inflight\_packets
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "10"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. A maximum number of unacknowledged in-flight packets in a single distributed cache read request

<h2 id="distributed_cache_min_bytes_for_seek">
  distributed\_cache\_min\_bytes\_for\_seek
</h2>

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

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

Only has an effect in ClickHouse Cloud. Minimum number of bytes to do seek in distributed cache.

<h2 id="distributed_cache_pool_behaviour_on_limit">
  distributed\_cache\_pool\_behaviour\_on\_limit
</h2>

<SettingsInfoBlock type="DistributedCachePoolBehaviourOnLimit" default_value="wait" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "wait"},{"label": "Cloud only"}]}, {"id": "row-2","items": [{"label": "24.10"},{"label": "allocate_bypassing_pool"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Identifies behaviour of distributed cache connection on pool limit reached

<h2 id="distributed_cache_prefer_bigger_buffer_size">
  distributed\_cache\_prefer\_bigger\_buffer\_size
</h2>

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

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

Only has an effect in ClickHouse Cloud. Same as filesystem\_cache\_prefer\_bigger\_buffer\_size, but for distributed cache.

<h2 id="distributed_cache_read_only_from_current_az">
  distributed\_cache\_read\_only\_from\_current\_az
</h2>

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

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

Only has an effect in ClickHouse Cloud. Allow to read only from current availability zone. If disabled, will read from all cache servers in all availability zones.

<h2 id="distributed_cache_read_request_max_tries">
  distributed\_cache\_read\_request\_max\_tries
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "10"},{"label": "Changed setting value"}]}, {"id": "row-2","items": [{"label": "25.4"},{"label": "20"},{"label": "New setting"}]}]} />

Only has an effect in ClickHouse Cloud. Number of tries to do distributed cache read request if unsuccessful

<h2 id="distributed_cache_receive_response_wait_milliseconds">
  distributed\_cache\_receive\_response\_wait\_milliseconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "60000"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Wait time in milliseconds to receive data for request from distributed cache

<h2 id="distributed_cache_receive_timeout_milliseconds">
  distributed\_cache\_receive\_timeout\_milliseconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "10000"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Wait time in milliseconds to receive any kind of response from distributed cache

Cloud default value: `20000`.

<h2 id="distributed_cache_receive_timeout_ms">
  distributed\_cache\_receive\_timeout\_ms
</h2>

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

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

Only has an effect in ClickHouse Cloud. Timeout for receiving data from distributed cache server, in milliseconds. If no bytes were received in this interval, the exception is thrown.

<h2 id="distributed_cache_send_timeout_ms">
  distributed\_cache\_send\_timeout\_ms
</h2>

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

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

Only has an effect in ClickHouse Cloud. Timeout for sending data to istributed cache server, in milliseconds. If a client needs to send some data but is not able to send any bytes in this interval, the exception is thrown.

<h2 id="distributed_cache_tcp_keep_alive_timeout_ms">
  distributed\_cache\_tcp\_keep\_alive\_timeout\_ms
</h2>

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

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

Only has an effect in ClickHouse Cloud. The time in milliseconds the connection to distributed cache server needs to remain idle before TCP starts sending keepalive probes.

<h2 id="distributed_cache_throw_on_error">
  distributed\_cache\_throw\_on\_error
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "0"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Rethrow exception happened during communication with distributed cache or exception received from distributed cache. Otherwise fallback to skipping distributed cache on error

<h2 id="distributed_cache_use_clients_cache_for_read">
  distributed\_cache\_use\_clients\_cache\_for\_read
</h2>

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

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

Only has an effect in ClickHouse Cloud. Use clients cache for read requests.

<h2 id="distributed_cache_use_clients_cache_for_write">
  distributed\_cache\_use\_clients\_cache\_for\_write
</h2>

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

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

Only has an effect in ClickHouse Cloud. Use clients cache for write requests.

<h2 id="distributed_cache_wait_connection_from_pool_milliseconds">
  distributed\_cache\_wait\_connection\_from\_pool\_milliseconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "100"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Wait time in milliseconds to receive connection from connection pool if distributed\_cache\_pool\_behaviour\_on\_limit is wait

<h2 id="distributed_cache_write_request_max_tries">
  distributed\_cache\_write\_request\_max\_tries
</h2>

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

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

Only has an effect in ClickHouse Cloud. Number of tries to do distributed cache write request if unsuccessful

<h2 id="distributed_connections_pool_size">
  distributed\_connections\_pool\_size
</h2>

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

The maximum number of simultaneous connections with remote servers for distributed processing of all queries to a single Distributed table. We recommend setting a value no less than the number of servers in the cluster.

<h2 id="distributed_ddl_entry_format_version">
  distributed\_ddl\_entry\_format\_version
</h2>

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

Compatibility version of distributed DDL (ON CLUSTER) queries

Cloud default value: `6`.

<h2 id="distributed_ddl_output_mode">
  distributed\_ddl\_output\_mode
</h2>

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

Sets format of distributed DDL query result.

Possible values:

* `throw` — Returns result set with query execution status for all hosts where query is finished. If query has failed on some hosts, then it will rethrow the first exception. If query is not finished yet on some hosts and [distributed\_ddl\_task\_timeout](#distributed_ddl_task_timeout) exceeded, then it throws `TIMEOUT_EXCEEDED` exception.
* `none` — Is similar to throw, but distributed DDL query returns no result set.
* `null_status_on_timeout` — Returns `NULL` as execution status in some rows of result set instead of throwing `TIMEOUT_EXCEEDED` if query is not finished on the corresponding hosts.
* `never_throw` — Do not throw `TIMEOUT_EXCEEDED` and do not rethrow exceptions if query has failed on some hosts.
* `none_only_active` - similar to `none`, but doesn't wait for inactive replicas of the `Replicated` database. Note: with this mode it's impossible to figure out that the query was not executed on some replica and will be executed in background.
* `null_status_on_timeout_only_active` — similar to `null_status_on_timeout`, but doesn't wait for inactive replicas of the `Replicated` database
* `throw_only_active` — similar to `throw`, but doesn't wait for inactive replicas of the `Replicated` database

Cloud default value: `none_only_active`.

<h2 id="distributed_ddl_task_timeout">
  distributed\_ddl\_task\_timeout
</h2>

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

Sets timeout for DDL query responses from all hosts in cluster. If a DDL request has not been performed on all hosts, a response will contain a timeout error and a request will be executed in an async mode. Negative value means infinite.

Possible values:

* Positive integer.
* 0 — Async mode.
* Negative integer — infinite timeout.

<h2 id="distributed_foreground_insert">
  distributed\_foreground\_insert
</h2>

**Aliases**: `insert_distributed_sync`

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

Enables or disables synchronous data insertion into a [Distributed](/reference/engines/table-engines/special/distributed) table.

By default, when inserting data into a `Distributed` table, the ClickHouse server sends data to cluster nodes in background mode. When `distributed_foreground_insert=1`, the data is processed synchronously, and the `INSERT` operation succeeds only after all the data is saved on all shards (at least one replica for each shard if `internal_replication` is true).

Possible values:

* `0` — Data is inserted in background mode.
* `1` — Data is inserted in synchronous mode.

Cloud default value: `1`.

**See Also**

* [Distributed Table Engine](/reference/engines/table-engines/special/distributed)
* [Managing Distributed Tables](/reference/statements/system#managing-distributed-tables)

<h2 id="distributed_group_by_no_merge">
  distributed\_group\_by\_no\_merge
</h2>

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

Do not merge aggregation states from different servers for distributed query processing, you can use this in case it is for certain that there are different keys on different shards

Possible values:

* `0` — Disabled (final query processing is done on the initiator node).
* `1` - Do not merge aggregation states from different servers for distributed query processing (query completely processed on the shard, initiator only proxy the data), can be used in case it is for certain that there are different keys on different shards.
* `2` - Same as `1` but applies `ORDER BY` and `LIMIT` (it is not possible when the query processed completely on the remote node, like for `distributed_group_by_no_merge=1`) on the initiator (can be used for queries with `ORDER BY` and/or `LIMIT`).

**Example**

```sql theme={null}
SELECT *
FROM remote('127.0.0.{2,3}', system.one)
GROUP BY dummy
LIMIT 1
SETTINGS distributed_group_by_no_merge = 1
FORMAT PrettyCompactMonoBlock

┌─dummy─┐
│     0 │
│     0 │
└───────┘
```

```sql theme={null}
SELECT *
FROM remote('127.0.0.{2,3}', system.one)
GROUP BY dummy
LIMIT 1
SETTINGS distributed_group_by_no_merge = 2
FORMAT PrettyCompactMonoBlock

┌─dummy─┐
│     0 │
└───────┘
```

<h2 id="distributed_index_analysis">
  distributed\_index\_analysis
</h2>

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

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

Index analysis will be distributed across replicas.
Beneficial for shared storage and huge amount of data in cluster.
Uses replicas from cluster\_for\_parallel\_replicas.

**See also**

* [distributed\_index\_analysis\_for\_non\_shared\_merge\_tree](#distributed_index_analysis_for_non_shared_merge_tree)
* [distributed\_index\_analysis\_min\_parts\_to\_activate](/reference/settings/merge-tree-settings#distributed_index_analysis_min_parts_to_activate)
* [distributed\_index\_analysis\_min\_indexes\_bytes\_to\_activate](/reference/settings/merge-tree-settings#distributed_index_analysis_min_indexes_bytes_to_activate)

<h2 id="distributed_index_analysis_for_non_shared_merge_tree">
  distributed\_index\_analysis\_for\_non\_shared\_merge\_tree
</h2>

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

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

Enable distributed index analysis even for non SharedMergeTree (cloud only engine).

<h2 id="distributed_index_analysis_only_on_coordinator">
  distributed\_index\_analysis\_only\_on\_coordinator
</h2>

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

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

If enabled, distributed index analysis runs only on the coordinator.
This prevents O(N^2) spawned queries when the predicate contains subqueries (e.g., `IN (SELECT ...)`),
because each follower replica would otherwise independently trigger its own distributed index analysis,
but makes distributed index analysis less efficient if large tables are used in the subqueries.

<h2 id="distributed_insert_skip_read_only_replicas">
  distributed\_insert\_skip\_read\_only\_replicas
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "If true, INSERT into Distributed will skip read-only replicas"}]}]} />

Enables skipping read-only replicas for INSERT queries into Distributed.

Possible values:

* 0 — INSERT was as usual, if it will go to read-only replica it will fail
* 1 — Initiator will skip read-only replicas before sending data to shards.

<h2 id="distributed_plan_default_reader_bucket_count">
  distributed\_plan\_default\_reader\_bucket\_count
</h2>

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

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

Default number of tasks for parallel reading in distributed query. Tasks are spread across between replicas.

<h2 id="distributed_plan_default_shuffle_join_bucket_count">
  distributed\_plan\_default\_shuffle\_join\_bucket\_count
</h2>

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

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

Default number of buckets for distributed shuffle-hash-join.

<h2 id="distributed_plan_execute_locally">
  distributed\_plan\_execute\_locally
</h2>

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

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

Run all tasks of a distributed query plan locally. Useful for testing and debugging.

<h2 id="distributed_plan_force_exchange_kind">
  distributed\_plan\_force\_exchange\_kind
</h2>

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

Force specified kind of Exchange operators between distributed query stages.

Possible values:

* '' - do not force any kind of Exchange operators, let the optimizer choose,
* 'Persisted' - use temporary files in object storage,
* 'Streaming' - stream exchange data over network.

<h2 id="distributed_plan_force_shuffle_aggregation">
  distributed\_plan\_force\_shuffle\_aggregation
</h2>

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

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

Use Shuffle aggregation strategy instead of PartialAggregation + Merge in distributed query plan.

<h2 id="distributed_plan_max_rows_to_broadcast">
  distributed\_plan\_max\_rows\_to\_broadcast
</h2>

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

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

Maximum rows to use broadcast join instead of shuffle join in distributed query plan.

<h2 id="distributed_plan_optimize_exchanges">
  distributed\_plan\_optimize\_exchanges
</h2>

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

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

Removes unnecessary exchanges in distributed query plan. Disable it for debugging.

<h2 id="distributed_plan_prefer_replicas_over_workers">
  distributed\_plan\_prefer\_replicas\_over\_workers
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "New setting to serialize distributed plan for replicas"}]}]} />

Serialize the distributed query plan for execution at replicas.

<h2 id="distributed_product_mode">
  distributed\_product\_mode
</h2>

<SettingsInfoBlock type="DistributedProductMode" default_value="deny" />

Changes the behaviour of [distributed subqueries](/reference/statements/in).

ClickHouse applies this setting when the query contains the product of distributed tables, i.e. when the query for a distributed table contains a non-GLOBAL subquery for the distributed table.

Restrictions:

* Only applied for IN and JOIN subqueries.
* Only if the FROM section uses a distributed table containing more than one shard.
* If the subquery concerns a distributed table containing more than one shard.
* Not used for a table-valued [remote](/reference/functions/table-functions/remote) function.

Possible values:

* `deny` — Default value. Prohibits using these types of subqueries (returns the "Double-distributed in/JOIN subqueries is denied" exception).
* `local` — Replaces the database and table in the subquery with local ones for the destination server (shard), leaving the normal `IN`/`JOIN.`
* `global` — Replaces the `IN`/`JOIN` query with `GLOBAL IN`/`GLOBAL JOIN.`
* `allow` — Allows the use of these types of subqueries.

<h2 id="distributed_push_down_limit">
  distributed\_push\_down\_limit
</h2>

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

Enables or disables [LIMIT](#limit) applying on each shard separately.

This will allow to avoid:

* Sending extra rows over network;
* Processing rows behind the limit on the initiator.

Starting from 21.9 version you cannot get inaccurate results anymore, since `distributed_push_down_limit` changes query execution only if at least one of the conditions met:

* [distributed\_group\_by\_no\_merge](#distributed_group_by_no_merge) > 0.
* Query **does not have** `GROUP BY`/`DISTINCT`/`LIMIT BY`, but it has `ORDER BY`/`LIMIT`.
* Query **has** `GROUP BY`/`DISTINCT`/`LIMIT BY` with `ORDER BY`/`LIMIT` and:
  * [optimize\_skip\_unused\_shards](#optimize_skip_unused_shards) is enabled.
  * [optimize\_distributed\_group\_by\_sharding\_key](#optimize_distributed_group_by_sharding_key) is enabled.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

See also:

* [distributed\_group\_by\_no\_merge](#distributed_group_by_no_merge)
* [optimize\_skip\_unused\_shards](#optimize_skip_unused_shards)
* [optimize\_distributed\_group\_by\_sharding\_key](#optimize_distributed_group_by_sharding_key)

<h2 id="distributed_replica_error_cap">
  distributed\_replica\_error\_cap
</h2>

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

* Type: unsigned int
* Default value: 1000

The error count of each replica is capped at this value, preventing a single replica from accumulating too many errors.

See also:

* [load\_balancing](#load_balancing-round_robin)
* [Table engine Distributed](/reference/engines/table-engines/special/distributed)
* [distributed\_replica\_error\_half\_life](#distributed_replica_error_half_life)
* [distributed\_replica\_max\_ignored\_errors](#distributed_replica_max_ignored_errors)

<h2 id="distributed_replica_error_half_life">
  distributed\_replica\_error\_half\_life
</h2>

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

* Type: seconds
* Default value: 60 seconds

Controls how fast errors in distributed tables are zeroed. If a replica is unavailable for some time, accumulates 5 errors, and distributed\_replica\_error\_half\_life is set to 1 second, then the replica is considered normal 3 seconds after the last error.

See also:

* [load\_balancing](#load_balancing-round_robin)
* [Table engine Distributed](/reference/engines/table-engines/special/distributed)
* [distributed\_replica\_error\_cap](#distributed_replica_error_cap)
* [distributed\_replica\_max\_ignored\_errors](#distributed_replica_max_ignored_errors)

<h2 id="distributed_replica_max_ignored_errors">
  distributed\_replica\_max\_ignored\_errors
</h2>

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

* Type: unsigned int
* Default value: 0

The number of errors that will be ignored while choosing replicas (according to `load_balancing` algorithm).

See also:

* [load\_balancing](#load_balancing-round_robin)
* [Table engine Distributed](/reference/engines/table-engines/special/distributed)
* [distributed\_replica\_error\_cap](#distributed_replica_error_cap)
* [distributed\_replica\_error\_half\_life](#distributed_replica_error_half_life)

<h2 id="do_not_merge_across_partitions_select_final">
  do\_not\_merge\_across\_partitions\_select\_final
</h2>

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

Improve FINAL queries by avoiding merges across different partitions.

When enabled, during SELECT FINAL queries, parts from different partitions will not be merged together. Instead, merging will only occur within each partition separately. This can significantly improve query performance when working with partitioned tables.

<h2 id="dynamic_disk_allow_from_env">
  dynamic\_disk\_allow\_from\_env
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting to allow `from_env` substitutions in dynamic disk configuration (the `disk()` function). Disabled by default for security."}]}]} />

Allow using `from_env` substitutions in the dynamic disk configuration (i.e. in the `disk()` function arguments).
Disabled by default to prevent users from reading arbitrary environment variables when defining table storage.

<h2 id="dynamic_disk_allow_from_zk">
  dynamic\_disk\_allow\_from\_zk
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting to allow `from_zk` substitutions in dynamic disk configuration (the `disk()` function). Disabled by default."}]}]} />

Allow using `from_zk` substitutions in the dynamic disk configuration (i.e. in the `disk()` function arguments).
Disabled by default.

<h2 id="dynamic_disk_allow_include">
  dynamic\_disk\_allow\_include
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting to allow `include` in dynamic disk configuration (the `disk()` function). Disabled by default."}]}]} />

Allow using `include` in the dynamic disk configuration (i.e. in the `disk()` function arguments).
Disabled by default.

<h2 id="dynamic_throw_on_type_mismatch">
  dynamic\_throw\_on\_type\_mismatch
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1"},{"label": "New setting to control type mismatch behavior in default Dynamic implementation"}]}]} />

When applying a function to a [Dynamic](/reference/data-types/dynamic) column using the default implementation,
controls what happens for rows whose actual type is incompatible with the function:

* `true` (default) — throw an exception.
* `false` — return `NULL` for those rows instead.

<h2 id="empty_result_for_aggregation_by_constant_keys_on_empty_set">
  empty\_result\_for\_aggregation\_by\_constant\_keys\_on\_empty\_set
</h2>

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

Return empty result when aggregating by constant keys on empty set.

<h2 id="empty_result_for_aggregation_by_empty_set">
  empty\_result\_for\_aggregation\_by\_empty\_set
</h2>

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

Return empty result when aggregating without keys on empty set.

<h2 id="enable_adaptive_memory_spill_scheduler">
  enable\_adaptive\_memory\_spill\_scheduler
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "0"},{"label": "New setting. Enable spill memory data into external storage adaptively."}]}]} />

Trigger processor to spill data into external storage adpatively. grace join is supported at present.

<h2 id="enable_add_distinct_to_in_subqueries">
  enable\_add\_distinct\_to\_in\_subqueries
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "0"},{"label": "New setting to reduce the size of temporary tables transferred for distributed IN subqueries."}]}]} />

Enable `DISTINCT` in `IN` subqueries. This is a trade-off setting: enabling it can greatly reduce the size of temporary tables transferred for distributed IN subqueries and significantly speed up data transfer between shards, by ensuring only unique values are sent.
However, enabling this setting adds extra merging effort on each node, as deduplication (DISTINCT) must be performed. Use this setting when network transfer is a bottleneck and the additional merging cost is acceptable.

<h2 id="enable_automatic_decision_for_merging_across_partitions_for_final">
  enable\_automatic\_decision\_for\_merging\_across\_partitions\_for\_final
</h2>

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

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

If set, ClickHouse will automatically enable this optimization when the partition key expression is deterministic and all columns used in the partition key expression are included in the primary key.
This automatic derivation ensures that rows with the same primary key values will always belong to the same partition, making it safe to avoid cross-partition merges.

<h2 id="enable_blob_storage_log">
  enable\_blob\_storage\_log
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "1"},{"label": "Write information about blob storage operations to system.blob_storage_log table"}]}]} />

Write information about blob storage operations to system.blob\_storage\_log table

<h2 id="enable_blob_storage_log_for_read_operations">
  enable\_blob\_storage\_log\_for\_read\_operations
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting to log blob storage read operations to system.blob_storage_log"}]}]} />

Write information about blob storage read operations to system.blob\_storage\_log table.
Requires `enable_blob_storage_log` to be enabled as well.

<h2 id="enable_early_constant_folding">
  enable\_early\_constant\_folding
</h2>

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

Enable query optimization where we analyze function and subqueries results and rewrite query if there are constants there

<h2 id="enable_extended_results_for_datetime_functions">
  enable\_extended\_results\_for\_datetime\_functions
</h2>

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

Enables or disables returning results of type `Date32` with extended range (compared to type `Date`)
or `DateTime64` with extended range (compared to type `DateTime`).

Possible values:

* `0` — Functions return `Date` or `DateTime` for all types of arguments.
* `1` — Functions return `Date32` or `DateTime64` for `Date32` or `DateTime64` arguments and `Date` or `DateTime` otherwise.

The table below shows the behavior of this setting for various date-time functions.

| Function                  | `enable_extended_results_for_datetime_functions = 0`                             | `enable_extended_results_for_datetime_functions = 1`                                                                     |
| ------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `toStartOfYear`           | Returns `Date` or `DateTime`                                                     | Returns `Date`/`DateTime` for `Date`/`DateTime` input<br />Returns `Date32`/`DateTime64` for `Date32`/`DateTime64` input |
| `toStartOfISOYear`        | Returns `Date` or `DateTime`                                                     | Returns `Date`/`DateTime` for `Date`/`DateTime` input<br />Returns `Date32`/`DateTime64` for `Date32`/`DateTime64` input |
| `toStartOfQuarter`        | Returns `Date` or `DateTime`                                                     | Returns `Date`/`DateTime` for `Date`/`DateTime` input<br />Returns `Date32`/`DateTime64` for `Date32`/`DateTime64` input |
| `toStartOfMonth`          | Returns `Date` or `DateTime`                                                     | Returns `Date`/`DateTime` for `Date`/`DateTime` input<br />Returns `Date32`/`DateTime64` for `Date32`/`DateTime64` input |
| `toStartOfWeek`           | Returns `Date` or `DateTime`                                                     | Returns `Date`/`DateTime` for `Date`/`DateTime` input<br />Returns `Date32`/`DateTime64` for `Date32`/`DateTime64` input |
| `toLastDayOfWeek`         | Returns `Date` or `DateTime`                                                     | Returns `Date`/`DateTime` for `Date`/`DateTime` input<br />Returns `Date32`/`DateTime64` for `Date32`/`DateTime64` input |
| `toLastDayOfMonth`        | Returns `Date` or `DateTime`                                                     | Returns `Date`/`DateTime` for `Date`/`DateTime` input<br />Returns `Date32`/`DateTime64` for `Date32`/`DateTime64` input |
| `toMonday`                | Returns `Date` or `DateTime`                                                     | Returns `Date`/`DateTime` for `Date`/`DateTime` input<br />Returns `Date32`/`DateTime64` for `Date32`/`DateTime64` input |
| `toStartOfDay`            | Returns `DateTime`<br />*Note: Wrong results for values outside 1970-2149 range* | Returns `DateTime` for `Date`/`DateTime` input<br />Returns `DateTime64` for `Date32`/`DateTime64` input                 |
| `toStartOfHour`           | Returns `DateTime`<br />*Note: Wrong results for values outside 1970-2149 range* | Returns `DateTime` for `Date`/`DateTime` input<br />Returns `DateTime64` for `Date32`/`DateTime64` input                 |
| `toStartOfFifteenMinutes` | Returns `DateTime`<br />*Note: Wrong results for values outside 1970-2149 range* | Returns `DateTime` for `Date`/`DateTime` input<br />Returns `DateTime64` for `Date32`/`DateTime64` input                 |
| `toStartOfTenMinutes`     | Returns `DateTime`<br />*Note: Wrong results for values outside 1970-2149 range* | Returns `DateTime` for `Date`/`DateTime` input<br />Returns `DateTime64` for `Date32`/`DateTime64` input                 |
| `toStartOfFiveMinutes`    | Returns `DateTime`<br />*Note: Wrong results for values outside 1970-2149 range* | Returns `DateTime` for `Date`/`DateTime` input<br />Returns `DateTime64` for `Date32`/`DateTime64` input                 |
| `toStartOfMinute`         | Returns `DateTime`<br />*Note: Wrong results for values outside 1970-2149 range* | Returns `DateTime` for `Date`/`DateTime` input<br />Returns `DateTime64` for `Date32`/`DateTime64` input                 |
| `timeSlot`                | Returns `DateTime`<br />*Note: Wrong results for values outside 1970-2149 range* | Returns `DateTime` for `Date`/`DateTime` input<br />Returns `DateTime64` for `Date32`/`DateTime64` input                 |

<h2 id="enable_filesystem_cache">
  enable\_filesystem\_cache
</h2>

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

Use cache for remote filesystem. This setting does not turn on/off cache for disks (must be done via disk config), but allows to bypass cache for some queries if intended

<h2 id="enable_filesystem_cache_log">
  enable\_filesystem\_cache\_log
</h2>

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

Allows to record the filesystem caching log for each query

<h2 id="enable_filesystem_cache_on_write_operations">
  enable\_filesystem\_cache\_on\_write\_operations
</h2>

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

Enables or disables `write-through` cache. If set to `false`, the `write-through` cache is disabled for write operations. If set to `true`, `write-through` cache is enabled as long as `cache_on_write_operations` is turned on in the server config's cache disk configuration section.
See ["Using local cache"](/concepts/features/configuration/server-config/storing-data#using-local-cache) for more details.

Cloud default value: `1`.

<h2 id="enable_filesystem_read_prefetches_log">
  enable\_filesystem\_read\_prefetches\_log
</h2>

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

Log to system.filesystem prefetch\_log during query. Should be used only for testing or debugging, not recommended to be turned on by default

<h2 id="enable_full_text_index">
  enable\_full\_text\_index
</h2>

**Aliases**: `allow_experimental_full_text_index`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "The text index is now GA"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "0"},{"label": "Text index was moved to Beta."}]}]} />

If set to true, allow using the text index.

<h2 id="enable_global_with_statement">
  enable\_global\_with\_statement
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.2"},{"label": "1"},{"label": "Propagate WITH statements to UNION queries and all subqueries by default"}]}]} />

Propagate WITH statements to UNION queries and all subqueries

<h2 id="enable_hdfs_pread">
  enable\_hdfs\_pread
</h2>

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

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

Enable or disables pread for HDFS files. By default, `hdfsPread` is used. If disabled, `hdfsRead` and `hdfsSeek` will be used to read hdfs files.

<h2 id="enable_http_compression">
  enable\_http\_compression
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "1"},{"label": "It should be beneficial in general"}]}]} />

Enables or disables data compression in the response to an HTTP request.

For more information, read the [HTTP interface description](/concepts/features/interfaces/http).

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="enable_identifier_resolve_cache">
  enable\_identifier\_resolve\_cache
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1"},{"label": "New setting to control the identifier resolution cache in the query analyzer"}]}]} />

Enable the identifier resolution cache in the query analyzer. The cache shares resolved alias nodes to prevent AST explosion when the same alias is referenced multiple times. Set to false to disable caching if incorrect results are suspected.

<h2 id="enable_job_stack_trace">
  enable\_job\_stack\_trace
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "0"},{"label": "The setting was disabled by default to avoid performance overhead."}]}, {"id": "row-2","items": [{"label": "24.11"},{"label": "0"},{"label": "Enables collecting stack traces from job's scheduling. Disabled by default to avoid performance overhead."}]}]} />

Output stack trace of a job creator when job results in exception. Disabled by default to avoid performance overhead.

<h2 id="enable_join_fixed_hash_table_conversion">
  enable\_join\_fixed\_hash\_table\_conversion
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1"},{"label": "New setting to enable converting the hash table to a flat array for joins when the key is a single integer with a small value range."}]}]} />

Enable converting the hash table to a flat array for joins when the key is a single integer with a small value range.

<h2 id="enable_join_runtime_filters">
  enable\_join\_runtime\_filters
</h2>

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

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

Filter left side by set of JOIN keys collected from the right side at runtime.

<h2 id="enable_join_transitive_predicates">
  enable\_join\_transitive\_predicates
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1"},{"label": "Turn on enable_join_transitive_predicates by default"}]}, {"id": "row-2","items": [{"label": "26.4"},{"label": "0"},{"label": "New setting to infer transitive equi-join predicates for join order optimization."}]}]} />

Infer transitive equi-join predicates from existing join conditions.
For example, given `A.x = B.x` and `B.x = C.x`, a synthetic `A.x = C.x` predicate
is added so the join order optimizer can consider direct (A JOIN C) plans.

<h2 id="enable_lazy_columns_replication">
  enable\_lazy\_columns\_replication
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1"},{"label": "Enable lazy columns replication in JOIN and ARRAY JOIN by default"}]}, {"id": "row-2","items": [{"label": "25.10"},{"label": "0"},{"label": "Add a setting to enable lazy columns replication in JOIN and ARRAY JOIN"}]}]} />

Enables lazy columns replication in JOIN and ARRAY JOIN, it allows to avoid unnecessary copy of the same rows multiple times in memory.

<h2 id="enable_lightweight_delete">
  enable\_lightweight\_delete
</h2>

**Aliases**: `allow_experimental_lightweight_delete`

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

Enable lightweight DELETE mutations for mergetree tables.

<h2 id="enable_lightweight_update">
  enable\_lightweight\_update
</h2>

**Aliases**: `allow_experimental_lightweight_update`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "Lightweight updates were moved to Beta. Added an alias for setting 'allow_experimental_lightweight_update'."}]}]} />

Allow to use lightweight updates.

<h2 id="enable_materialized_cte">
  enable\_materialized\_cte
</h2>

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

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

Enable materialized common table expressions, it will be preferred over enable\_global\_with\_statement

<h2 id="enable_memory_bound_merging_of_aggregation_results">
  enable\_memory\_bound\_merging\_of\_aggregation\_results
</h2>

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

Enable memory bound merging strategy for aggregation.

<h2 id="enable_multiple_prewhere_read_steps">
  enable\_multiple\_prewhere\_read\_steps
</h2>

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

Move more conditions from WHERE to PREWHERE and do reads from disk and filtering in multiple steps if there are multiple conditions combined with AND

<h2 id="enable_named_columns_in_function_tuple">
  enable\_named\_columns\_in\_function\_tuple
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "0"},{"label": "Generate named tuples in function tuple() when all names are unique and can be treated as unquoted identifiers."}]}, {"id": "row-2","items": [{"label": "24.10"},{"label": "0"},{"label": "Disabled pending usability improvements"}]}]} />

Generate named tuples in function tuple() when all names are unique and can be treated as unquoted identifiers.

<h2 id="enable_optimize_predicate_expression">
  enable\_optimize\_predicate\_expression
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "18.12.17"},{"label": "1"},{"label": "Optimize predicates to subqueries by default"}]}]} />

Turns on predicate pushdown in `SELECT` queries.

Predicate pushdown may significantly reduce network traffic for distributed queries.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

Usage

Consider the following queries:

1. `SELECT count() FROM test_table WHERE date = '2018-10-10'`
2. `SELECT count() FROM (SELECT * FROM test_table) WHERE date = '2018-10-10'`

If `enable_optimize_predicate_expression = 1`, then the execution time of these queries is equal because ClickHouse applies `WHERE` to the subquery when processing it.

If `enable_optimize_predicate_expression = 0`, then the execution time of the second query is much longer because the `WHERE` clause applies to all the data after the subquery finishes.

<h2 id="enable_optimize_predicate_expression_to_final_subquery">
  enable\_optimize\_predicate\_expression\_to\_final\_subquery
</h2>

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

Allow push predicate to final subquery.

<h2 id="enable_order_by_all">
  enable\_order\_by\_all
</h2>

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

Enables or disables sorting with `ORDER BY ALL` syntax, see [ORDER BY](/reference/statements/select/order-by).

Possible values:

* 0 — Disable ORDER BY ALL.
* 1 — Enable ORDER BY ALL.

**Example**

Query:

```sql theme={null}
CREATE TABLE TAB(C1 Int, C2 Int, ALL Int) ENGINE=Memory();

INSERT INTO TAB VALUES (10, 20, 30), (20, 20, 10), (30, 10, 20);

SELECT * FROM TAB ORDER BY ALL; -- returns an error that ALL is ambiguous

SELECT * FROM TAB ORDER BY ALL SETTINGS enable_order_by_all = 0;
```

Result:

```text theme={null}
┌─C1─┬─C2─┬─ALL─┐
│ 20 │ 20 │  10 │
│ 30 │ 10 │  20 │
│ 10 │ 20 │  30 │
└────┴────┴─────┘
```

<h2 id="enable_parallel_blocks_marshalling">
  enable\_parallel\_blocks\_marshalling
</h2>

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

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

Affects only distributed queries. If enabled, blocks will be (de)serialized and (de)compressed on pipeline threads (i.e. with higher parallelism that what we have by default) before/after sending to the initiator.

<h2 id="enable_parsing_to_custom_serialization">
  enable\_parsing\_to\_custom\_serialization
</h2>

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

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

If true then data can be parsed directly to columns with custom serialization (e.g. Sparse) according to hints for serialization got from the table.

<h2 id="enable_positional_arguments">
  enable\_positional\_arguments
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.7"},{"label": "1"},{"label": "Enable positional arguments feature by default"}]}]} />

Enables or disables supporting positional arguments for [GROUP BY](/reference/statements/select/group-by), [LIMIT BY](/reference/statements/select/limit-by), [ORDER BY](/reference/statements/select/order-by) statements.

Possible values:

* 0 — Positional arguments aren't supported.
* 1 — Positional arguments are supported: column numbers can use instead of column names.

**Example**

Query:

```sql theme={null}
CREATE TABLE positional_arguments(one Int, two Int, three Int) ENGINE=Memory();

INSERT INTO positional_arguments VALUES (10, 20, 30), (20, 20, 10), (30, 10, 20);

SELECT * FROM positional_arguments ORDER BY 2,3;
```

Result:

```text theme={null}
┌─one─┬─two─┬─three─┐
│  30 │  10 │   20  │
│  20 │  20 │   10  │
│  10 │  20 │   30  │
└─────┴─────┴───────┘
```

<h2 id="enable_positional_arguments_for_projections">
  enable\_positional\_arguments\_for\_projections
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "0"},{"label": "New setting to control positional arguments in projections."}]}, {"id": "row-2","items": [{"label": "25.11"},{"label": "0"},{"label": "New setting to control positional arguments in projections."}]}, {"id": "row-3","items": [{"label": "25.10"},{"label": "0"},{"label": "New setting to control positional arguments in projections."}]}]} />

Enables or disables supporting positional arguments in PROJECTION definitions. See also [enable\_positional\_arguments](#enable_positional_arguments) setting.

<Note>
  This is an expert-level setting, and you shouldn't change it if you're just getting started with ClickHouse.
</Note>

Possible values:

* 0 — Positional arguments aren't supported.
* 1 — Positional arguments are supported: column numbers can use instead of column names.

<h2 id="enable_producing_buckets_out_of_order_in_aggregation">
  enable\_producing\_buckets\_out\_of\_order\_in\_aggregation
</h2>

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

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

Allow memory-efficient aggregation (see `distributed_aggregation_memory_efficient`) to produce buckets out of order.
It may improve performance when aggregation bucket sizes are skewed by letting a replica to send buckets with higher id-s to the initiator while it is still processing some heavy buckets with lower id-s.
The downside is potentially higher memory usage.

<h2 id="enable_reads_from_query_cache">
  enable\_reads\_from\_query\_cache
</h2>

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

If turned on, results of `SELECT` queries are retrieved from the [query cache](/concepts/features/performance/caches/query-cache).

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="enable_s3_requests_logging">
  enable\_s3\_requests\_logging
</h2>

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

Enable very explicit logging of S3 requests. Makes sense for debug only.

<h2 id="enable_scalar_subquery_optimization">
  enable\_scalar\_subquery\_optimization
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "19.18"},{"label": "1"},{"label": "Prevent scalar subqueries from (de)serializing large scalar values and possibly avoid running the same subquery more than once"}]}]} />

If it is set to true, prevent scalar subqueries from (de)serializing large scalar values and possibly avoid running the same subquery more than once.

<h2 id="enable_scopes_for_with_statement">
  enable\_scopes\_for\_with\_statement
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "1"},{"label": "New setting for backward compatibility with the old analyzer."}]}, {"id": "row-2","items": [{"label": "25.6"},{"label": "1"},{"label": "New setting for backward compatibility with the old analyzer."}]}, {"id": "row-3","items": [{"label": "25.5"},{"label": "1"},{"label": "New setting for backward compatibility with the old analyzer."}]}, {"id": "row-4","items": [{"label": "25.4"},{"label": "1"},{"label": "New setting for backward compatibility with the old analyzer."}]}]} />

If disabled, declarations in parent WITH cluases will behave the same scope as they declared in the current scope.

Note that this is a compatibility setting for the analyzer to allow running some invalid queries that old analyzer could execute.

<h2 id="enable_sharding_aggregator">
  enable\_sharding\_aggregator
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "0"},{"label": "New setting to enable sharded `GROUP BY` optimization that distributes rows across threads by hashing the grouping key, so each thread aggregates a disjoint subset of keys without a merge phase; this is efficient for high cardinality keys with evenly distributed data."}]}]} />

Enables sharded `GROUP BY` optimization that distributes rows across threads by hashing the grouping key, so each thread aggregates a disjoint subset of keys without a merge phase.

This is efficient for high-cardinality keys with evenly distributed data, but may suffer from highly skewed key distributions or queries with very few distinct keys.

Possible values:

* 0 — Sharded aggregation optimization is disabled.
* 1 — Sharded aggregation optimization is enabled.

<h2 id="enable_shared_storage_snapshot_in_query">
  enable\_shared\_storage\_snapshot\_in\_query
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "0"},{"label": "A new setting to share storage snapshot in query"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "1"},{"label": "Enable share storage snapshot in query by default"}]}]} />

If enabled, all subqueries within a single query will share the same StorageSnapshot for each table.
This ensures a consistent view of the data across the entire query, even if the same table is accessed multiple times.

This is required for queries where internal consistency of data parts is important. Example:

```sql theme={null}
SELECT
    count()
FROM events
WHERE (_part, _part_offset) IN (
    SELECT _part, _part_offset
    FROM events
    WHERE user_id = 42
)
```

Without this setting, the outer and inner queries may operate on different data snapshots, leading to incorrect results.

<Note>
  Enabling this setting disables the optimization which removes unnecessary data parts from snapshots once the planning stage is complete.
  As a result, long-running queries may hold onto obsolete parts for their entire duration, delaying part cleanup and increasing storage pressure.

  This setting currently applies only to tables from the MergeTree family.
</Note>

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="enable_sharing_sets_for_mutations">
  enable\_sharing\_sets\_for\_mutations
</h2>

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

Allow sharing set objects build for IN subqueries between different tasks of the same mutation. This reduces memory usage and CPU consumptio

<h2 id="enable_software_prefetch_in_aggregation">
  enable\_software\_prefetch\_in\_aggregation
</h2>

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

Enable use of software prefetch in aggregatio

<h2 id="enable_software_prefetch_in_join">
  enable\_software\_prefetch\_in\_join
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1"},{"label": "Enable use of software prefetch in hash join probe phase."}]}]} />

Enable use of software prefetch in hash join probe phase to hide memory access latency for large hash tables.

<h2 id="enable_streaming_queries">
  enable\_streaming\_queries
</h2>

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

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

Allow `SELECT ... FROM t STREAM [CURSOR '{...}']` continuous queries.
When off, any table expression using the `STREAM` modifier is rejected
at plan-build time. This is the umbrella gate for the streaming-queries
feature; additional capabilities may be gated by their own settings.

<h2 id="enable_time_time64_type">
  enable\_time\_time64\_type
</h2>

**Aliases**: `allow_experimental_time_time64_type`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "0"},{"label": "New settings. Allows to use a new experimental Time and Time64 data types."}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "1"},{"label": "Enable Time and Time64 type by default"}]}]} />

Allows creation of [Time](/reference/data-types/time) and [Time64](/reference/data-types/time64) data types.

<h2 id="enable_unaligned_array_join">
  enable\_unaligned\_array\_join
</h2>

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

Allow ARRAY JOIN with multiple arrays that have different sizes. When this settings is enabled, arrays will be resized to the longest one.

<h2 id="enable_url_encoding">
  enable\_url\_encoding
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "0"},{"label": "Changed existing setting's default value"}]}]} />

Allows to enable/disable decoding/encoding path in uri in [URL](/reference/engines/table-engines/special/url) engine tables.

Disabled by default.

<h2 id="enable_vertical_final">
  enable\_vertical\_final
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "1"},{"label": "Enable vertical final by default again after fixing bug"}]}, {"id": "row-2","items": [{"label": "24.1"},{"label": "1"},{"label": "Use vertical final by default"}]}]} />

If enable, remove duplicated rows during FINAL by marking rows as deleted and filtering them later instead of merging rows

<h2 id="enable_writes_to_query_cache">
  enable\_writes\_to\_query\_cache
</h2>

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

If turned on, results of `SELECT` queries are stored in the [query cache](/concepts/features/performance/caches/query-cache).

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="enforce_strict_identifier_format">
  enforce\_strict\_identifier\_format
</h2>

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

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

If enabled, only allow identifiers containing alphanumeric characters and underscores.

<h2 id="engine_file_allow_create_multiple_files">
  engine\_file\_allow\_create\_multiple\_files
</h2>

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

Enables or disables creating a new file on each insert in file engine tables if the format has the suffix (`JSON`, `ORC`, `Parquet`, etc.). If enabled, on each insert a new file will be created with a name following this pattern:

`data.Parquet` -> `data.1.Parquet` -> `data.2.Parquet`, etc.

Possible values:

* 0 — `INSERT` query appends new data to the end of the file.
* 1 — `INSERT` query creates a new file.

<h2 id="engine_file_empty_if_not_exists">
  engine\_file\_empty\_if\_not\_exists
</h2>

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

Allows to select data from a file engine table without file.

Possible values:

* 0 — `SELECT` throws exception.
* 1 — `SELECT` returns empty result.

<h2 id="engine_file_skip_empty_files">
  engine\_file\_skip\_empty\_files
</h2>

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

Enables or disables skipping empty files in [File](/reference/engines/table-engines/special/file) engine tables.

Possible values:

* 0 — `SELECT` throws an exception if empty file is not compatible with requested format.
* 1 — `SELECT` returns empty result for empty file.

<h2 id="engine_file_truncate_on_insert">
  engine\_file\_truncate\_on\_insert
</h2>

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

Enables or disables truncate before insert in [File](/reference/engines/table-engines/special/file) engine tables.

Possible values:

* 0 — `INSERT` query appends new data to the end of the file.
* 1 — `INSERT` query replaces existing content of the file with the new data.

<h2 id="engine_url_skip_empty_files">
  engine\_url\_skip\_empty\_files
</h2>

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

Enables or disables skipping empty files in [URL](/reference/engines/table-engines/special/url) engine tables.

Possible values:

* 0 — `SELECT` throws an exception if empty file is not compatible with requested format.
* 1 — `SELECT` returns empty result for empty file.

<h2 id="exact_rows_before_limit">
  exact\_rows\_before\_limit
</h2>

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

When enabled, ClickHouse will provide exact value for rows\_before\_limit\_at\_least statistic, but with the cost that the data before limit will have to be read completely

<h2 id="except_default_mode">
  except\_default\_mode
</h2>

<SettingsInfoBlock type="SetOperationMode" default_value="ALL" />

Set default mode in EXCEPT query. Possible values: empty string, 'ALL', 'DISTINCT'. If empty, query without mode will throw exception.

<h2 id="exclude_materialize_skip_indexes_on_insert">
  exclude\_materialize\_skip\_indexes\_on\_insert
</h2>

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

Excludes specified skip indexes from being built and stored during INSERTs. The excluded skip indexes will still be built and stored [during merges](/reference/settings/merge-tree-settings#materialize_skip_indexes_on_merge) or by an explicit
[MATERIALIZE INDEX](/reference/statements/alter/skipping-index#materialize-index) query.

Has no effect if [materialize\_skip\_indexes\_on\_insert](#materialize_skip_indexes_on_insert) is false.

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();

SET exclude_materialize_skip_indexes_on_insert='idx_a'; -- idx_a will be not be updated upon insert
--SET exclude_materialize_skip_indexes_on_insert='idx_a, idx_b'; -- neither index would be updated on insert

INSERT INTO tab SELECT number, number / 50 FROM numbers(100); -- only idx_b is updated

-- since it is a session setting it can be set on a per-query level
INSERT INTO tab SELECT number, number / 50 FROM numbers(100, 100) SETTINGS exclude_materialize_skip_indexes_on_insert='idx_b';

ALTER TABLE tab MATERIALIZE INDEX idx_a; -- this query can be used to explicitly materialize the index

SET exclude_materialize_skip_indexes_on_insert = DEFAULT; -- reset setting to default
```

<h2 id="execute_exists_as_scalar_subquery">
  execute\_exists\_as\_scalar\_subquery
</h2>

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

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

Execute non-correlated EXISTS subqueries as scalar subqueries. As for scalar subqueries, the cache is used, and the constant folding applies to the result.

Cloud default value: `0`.

<h2 id="external_storage_connect_timeout_sec">
  external\_storage\_connect\_timeout\_sec
</h2>

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

Connect timeout in seconds. Now supported only for MySQL

<h2 id="external_storage_max_read_bytes">
  external\_storage\_max\_read\_bytes
</h2>

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

Limit maximum number of bytes when table with external engine should flush history data. Now supported only for MySQL table engine, database engine, and dictionary. If equal to 0, this setting is disabled

<h2 id="external_storage_max_read_rows">
  external\_storage\_max\_read\_rows
</h2>

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

Limit maximum number of rows when table with external engine should flush history data. Now supported only for MySQL table engine, database engine, and dictionary. If equal to 0, this setting is disabled

<h2 id="external_storage_rw_timeout_sec">
  external\_storage\_rw\_timeout\_sec
</h2>

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

Read/write timeout in seconds. Now supported only for MySQL

<h2 id="external_table_functions_use_nulls">
  external\_table\_functions\_use\_nulls
</h2>

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

Defines how [mysql](/reference/functions/table-functions/mysql), [postgresql](/reference/functions/table-functions/postgresql) and [odbc](/reference/functions/table-functions/odbc) table functions use Nullable columns.

Possible values:

* 0 — The table function explicitly uses Nullable columns.
* 1 — The table function implicitly uses Nullable columns.

**Usage**

If the setting is set to `0`, the table function does not make Nullable columns and inserts default values instead of NULL. This is also applicable for NULL values inside arrays.

<h2 id="external_table_strict_query">
  external\_table\_strict\_query
</h2>

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

If it is set to true, transforming expression to local filter is forbidden for queries to external tables.

<h2 id="extract_key_value_pairs_max_pairs_per_row">
  extract\_key\_value\_pairs\_max\_pairs\_per\_row
</h2>

**Aliases**: `extract_kvp_max_pairs_per_row`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "0"},{"label": "Max number of pairs that can be produced by the `extractKeyValuePairs` function. Used as a safeguard against consuming too much memory."}]}]} />

Max number of pairs that can be produced by the `extractKeyValuePairs` function. Used as a safeguard against consuming too much memory.

<h2 id="extremes">
  extremes
</h2>

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

Whether to count extreme values (the minimums and maximums in columns of a query result). Accepts 0 or 1. By default, 0 (disabled).
For more information, see the section "Extreme values".

<h2 id="fallback_to_stale_replicas_for_distributed_queries">
  fallback\_to\_stale\_replicas\_for\_distributed\_queries
</h2>

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

Forces a query to an out-of-date replica if updated data is not available. See [Replication](/reference/engines/table-engines/mergetree-family/replication).

ClickHouse selects the most relevant from the outdated replicas of the table.

Used when performing `SELECT` from a distributed table that points to replicated tables.

By default, 1 (enabled).

<h2 id="file_like_engine_default_partition_strategy">
  file\_like\_engine\_default\_partition\_strategy
</h2>

<SettingsInfoBlock type="FileLikeEngineDefaultPartitionStrategy" default_value="hive" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "hive"},{"label": "Change the default partition strategy for file-like table engines (S3, AzureBlobStorage, etc.) from `wildcard` to `hive` when no `partition_strategy` is provided."}]}]} />

Default partition strategy for file like engines.

<h2 id="filesystem_cache_allow_background_download">
  filesystem\_cache\_allow\_background\_download
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1"},{"label": "New setting to control background downloads in filesystem cache per query."}]}]} />

Allow filesystem cache to enqueue background downloads for data read from remote storage. Disable to keep downloads in the foreground for the current query/session.

<h2 id="filesystem_cache_boundary_alignment">
  filesystem\_cache\_boundary\_alignment
</h2>

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

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

Filesystem cache boundary alignment. This setting is applied only for non-disk read (e.g. for cache of remote table engines / table functions, but not for storage configuration of MergeTree tables). Value 0 means no alignment.

<h2 id="filesystem_cache_enable_background_download_during_fetch">
  filesystem\_cache\_enable\_background\_download\_during\_fetch
</h2>

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

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

Only has an effect in ClickHouse Cloud. Wait time to lock cache for space reservation in filesystem cache

<h2 id="filesystem_cache_enable_background_download_for_metadata_files_in_packed_storage">
  filesystem\_cache\_enable\_background\_download\_for\_metadata\_files\_in\_packed\_storage
</h2>

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

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

Only has an effect in ClickHouse Cloud. Wait time to lock cache for space reservation in filesystem cache

<h2 id="filesystem_cache_max_download_size">
  filesystem\_cache\_max\_download\_size
</h2>

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

Max remote filesystem cache size that can be downloaded by a single query

<h2 id="filesystem_cache_name">
  filesystem\_cache\_name
</h2>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": ""},{"label": "Filesystem cache name to use for stateless table engines or data lakes"}]}]} />

Filesystem cache name to use for stateless table engines or data lakes

<h2 id="filesystem_cache_prefer_bigger_buffer_size">
  filesystem\_cache\_prefer\_bigger\_buffer\_size
</h2>

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

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

Prefer bigger buffer size if filesystem cache is enabled to avoid writing small file segments which deteriorate cache performance. On the other hand, enabling this setting might increase memory usage.

<h2 id="filesystem_cache_reserve_space_wait_lock_timeout_milliseconds">
  filesystem\_cache\_reserve\_space\_wait\_lock\_timeout\_milliseconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1000"},{"label": "Wait time to lock cache for space reservation in filesystem cache"}]}]} />

Wait time to lock cache for space reservation in filesystem cache

<h2 id="filesystem_cache_segments_batch_size">
  filesystem\_cache\_segments\_batch\_size
</h2>

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

Limit on size of a single batch of file segments that a read buffer can request from cache. Too low value will lead to excessive requests to cache, too large may slow down eviction from cache

<h2 id="filesystem_cache_skip_download_if_exceeds_per_query_cache_write_limit">
  filesystem\_cache\_skip\_download\_if\_exceeds\_per\_query\_cache\_write\_limit
</h2>

**Aliases**: `skip_download_if_exceeds_query_cache`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "1"},{"label": "Rename of setting skip_download_if_exceeds_query_cache_limit"}]}]} />

Skip download from remote filesystem if exceeds query cache size

<h2 id="filesystem_prefetch_max_memory_usage">
  filesystem\_prefetch\_max\_memory\_usage
</h2>

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

Maximum memory usage for prefetches.

Cloud default value: 10% of total memory.

<h2 id="filesystem_prefetch_step_bytes">
  filesystem\_prefetch\_step\_bytes
</h2>

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

Prefetch step in bytes. Zero means `auto` - approximately the best prefetch step will be auto deduced, but might not be 100% the best. The actual value might be different because of setting filesystem\_prefetch\_min\_bytes\_for\_single\_read\_task

<h2 id="filesystem_prefetch_step_marks">
  filesystem\_prefetch\_step\_marks
</h2>

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

Prefetch step in marks. Zero means `auto` - approximately the best prefetch step will be auto deduced, but might not be 100% the best. The actual value might be different because of setting filesystem\_prefetch\_min\_bytes\_for\_single\_read\_task

<h2 id="filesystem_prefetches_limit">
  filesystem\_prefetches\_limit
</h2>

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

Maximum number of prefetches. Zero means unlimited. A setting `filesystem_prefetches_max_memory_usage` is more recommended if you want to limit the number of prefetches

<h2 id="final">
  final
</h2>

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

Automatically applies [FINAL](/reference/statements/select/from#final-modifier) modifier to all tables in a query, to tables where [FINAL](/reference/statements/select/from#final-modifier) is applicable, including joined tables and tables in sub-queries, and
distributed tables.

Possible values:

* 0 - disabled
* 1 - enabled

Example:

```sql theme={null}
CREATE TABLE test
(
    key Int64,
    some String
)
ENGINE = ReplacingMergeTree
ORDER BY key;

INSERT INTO test FORMAT Values (1, 'first');
INSERT INTO test FORMAT Values (1, 'second');

SELECT * FROM test;
┌─key─┬─some───┐
│   1 │ second │
└─────┴────────┘
┌─key─┬─some──┐
│   1 │ first │
└─────┴───────┘

SELECT * FROM test SETTINGS final = 1;
┌─key─┬─some───┐
│   1 │ second │
└─────┴────────┘

SET final = 1;
SELECT * FROM test;
┌─key─┬─some───┐
│   1 │ second │
└─────┴────────┘
```

<h2 id="finalize_projection_parts_synchronously">
  finalize\_projection\_parts\_synchronously
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "New setting to finalize projection parts synchronously during INSERT to reduce peak memory usage."}]}]} />

When enabled, projection parts are finalized synchronously during INSERT, reducing peak memory usage at the cost of reduced S3 upload parallelism. By default, each projection's output stream is kept alive until the entire part (including all projections) is finalized, which allows overlapping S3 uploads but increases peak memory proportional to the number of projections. This setting only affects the INSERT path; merge and mutation already finalize projections synchronously.

<h2 id="flatten_nested">
  flatten\_nested
</h2>

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

Sets the data format of a [nested](/reference/data-types/nested-data-structures/index) columns.

Possible values:

* 1 — Nested column is flattened to separate arrays.
* 0 — Nested column stays a single array of tuples.

**Usage**

If the setting is set to `0`, it is possible to use an arbitrary level of nesting.

**Examples**

Query:

```sql theme={null}
SET flatten_nested = 1;
CREATE TABLE t_nest (`n` Nested(a UInt32, b UInt32)) ENGINE = MergeTree ORDER BY tuple();

SHOW CREATE TABLE t_nest;
```

Result:

```text theme={null}
┌─statement───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ CREATE TABLE default.t_nest
(
    `n.a` Array(UInt32),
    `n.b` Array(UInt32)
)
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS index_granularity = 8192 │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

Query:

```sql theme={null}
SET flatten_nested = 0;

CREATE TABLE t_nest (`n` Nested(a UInt32, b UInt32)) ENGINE = MergeTree ORDER BY tuple();

SHOW CREATE TABLE t_nest;
```

Result:

```text theme={null}
┌─statement──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ CREATE TABLE default.t_nest
(
    `n` Nested(a UInt32, b UInt32)
)
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS index_granularity = 8192 │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

<h2 id="force_aggregate_partitions_independently">
  force\_aggregate\_partitions\_independently
</h2>

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

Force the use of optimization when it is applicable, but heuristics decided not to use it

<h2 id="force_aggregation_in_order">
  force\_aggregation\_in\_order
</h2>

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

The setting is used by the server itself to support distributed queries. Do not change it manually, because it will break normal operations. (Forces use of aggregation in order on remote nodes during distributed aggregation).

<h2 id="force_data_skipping_indices">
  force\_data\_skipping\_indices
</h2>

Disables query execution if passed data skipping indices wasn't used.

Consider the following example:

```sql theme={null}
CREATE TABLE data
(
    key Int,
    d1 Int,
    d1_null Nullable(Int),
    INDEX d1_idx d1 TYPE minmax GRANULARITY 1,
    INDEX d1_null_idx assumeNotNull(d1_null) TYPE minmax GRANULARITY 1
)
Engine=MergeTree()
ORDER BY key;

SELECT * FROM data_01515;
SELECT * FROM data_01515 SETTINGS force_data_skipping_indices=''; -- query will produce CANNOT_PARSE_TEXT error.
SELECT * FROM data_01515 SETTINGS force_data_skipping_indices='d1_idx'; -- query will produce INDEX_NOT_USED error.
SELECT * FROM data_01515 WHERE d1 = 0 SETTINGS force_data_skipping_indices='d1_idx'; -- Ok.
SELECT * FROM data_01515 WHERE d1 = 0 SETTINGS force_data_skipping_indices='`d1_idx`'; -- Ok (example of full featured parser).
SELECT * FROM data_01515 WHERE d1 = 0 SETTINGS force_data_skipping_indices='`d1_idx`, d1_null_idx'; -- query will produce INDEX_NOT_USED error, since d1_null_idx is not used.
SELECT * FROM data_01515 WHERE d1 = 0 AND assumeNotNull(d1_null) = 0 SETTINGS force_data_skipping_indices='`d1_idx`, d1_null_idx'; -- Ok.
```

<h2 id="force_grouping_standard_compatibility">
  force\_grouping\_standard\_compatibility
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.9"},{"label": "1"},{"label": "Make GROUPING function output the same as in SQL standard and other DBMS"}]}]} />

Make GROUPING function to return 1 when argument is not used as an aggregation key

<h2 id="force_index_by_date">
  force\_index\_by\_date
</h2>

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

Disables query execution if the index can't be used by date.

Works with tables in the MergeTree family.

If `force_index_by_date=1`, ClickHouse checks whether the query has a date key condition that can be used for restricting data ranges. If there is no suitable condition, it throws an exception. However, it does not check whether the condition reduces the amount of data to read. For example, the condition `Date != ' 2000-01-01 '` is acceptable even when it matches all the data in the table (i.e., running the query requires a full scan). For more information about ranges of data in MergeTree tables, see [MergeTree](/reference/engines/table-engines/mergetree-family/mergetree).

<h2 id="force_optimize_projection">
  force\_optimize\_projection
</h2>

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

Enables or disables the obligatory use of [projections](/reference/engines/table-engines/mergetree-family/mergetree#projections) in `SELECT` queries, when projection optimization is enabled (see [optimize\_use\_projections](#optimize_use_projections) setting).

Possible values:

* 0 — Projection optimization is not obligatory.
* 1 — Projection optimization is obligatory.

<h2 id="force_optimize_projection_name">
  force\_optimize\_projection\_name
</h2>

If it is set to a non-empty string, check that this projection is used in the query at least once.

Possible values:

* string: name of projection that used in a query

<h2 id="force_optimize_skip_unused_shards">
  force\_optimize\_skip\_unused\_shards
</h2>

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

Enables or disables query execution if [optimize\_skip\_unused\_shards](#optimize_skip_unused_shards) is enabled and skipping of unused shards is not possible. If the skipping is not possible and the setting is enabled, an exception will be thrown.

Possible values:

* 0 — Disabled. ClickHouse does not throw an exception.
* 1 — Enabled. Query execution is disabled only if the table has a sharding key.
* 2 — Enabled. Query execution is disabled regardless of whether a sharding key is defined for the table.

<h2 id="force_optimize_skip_unused_shards_nesting">
  force\_optimize\_skip\_unused\_shards\_nesting
</h2>

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

Controls [`force_optimize_skip_unused_shards`](#force_optimize_skip_unused_shards) (hence still requires [`force_optimize_skip_unused_shards`](#force_optimize_skip_unused_shards)) depends on the nesting level of the distributed query (case when you have `Distributed` table that look into another `Distributed` table).

Possible values:

* 0 - Disabled, `force_optimize_skip_unused_shards` works always.
* 1 — Enables `force_optimize_skip_unused_shards` only for the first level.
* 2 — Enables `force_optimize_skip_unused_shards` up to the second level.

<h2 id="force_primary_key">
  force\_primary\_key
</h2>

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

Disables query execution if indexing by the primary key is not possible.

Works with tables in the MergeTree family.

If `force_primary_key=1`, ClickHouse checks to see if the query has a primary key condition that can be used for restricting data ranges. If there is no suitable condition, it throws an exception. However, it does not check whether the condition reduces the amount of data to read. For more information about data ranges in MergeTree tables, see [MergeTree](/reference/engines/table-engines/mergetree-family/mergetree).

<h2 id="force_remove_data_recursively_on_drop">
  force\_remove\_data\_recursively\_on\_drop
</h2>

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

Recursively remove data on DROP query. Avoids 'Directory not empty' error, but may silently remove detached data

<h2 id="formatdatetime_e_with_space_padding">
  formatdatetime\_e\_with\_space\_padding
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "0"},{"label": "Improved compatibility with MySQL DATE_FORMAT/STR_TO_DATE"}]}]} />

Formatter '%e' in function 'formatDateTime' prints single-digit days with a leading space, e.g. ' 2' instead of '2'.

<h2 id="formatdatetime_f_prints_scale_number_of_digits">
  formatdatetime\_f\_prints\_scale\_number\_of\_digits
</h2>

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

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

Formatter '%f' in function 'formatDateTime' prints only the scale amount of digits for a DateTime64 instead of fixed 6 digits.

<h2 id="formatdatetime_f_prints_single_zero">
  formatdatetime\_f\_prints\_single\_zero
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.4"},{"label": "0"},{"label": "Improved compatibility with MySQL DATE_FORMAT()/STR_TO_DATE()"}]}]} />

Formatter '%f' in function 'formatDateTime' prints a single zero instead of six zeros if the formatted value has no fractional seconds.

<h2 id="formatdatetime_format_without_leading_zeros">
  formatdatetime\_format\_without\_leading\_zeros
</h2>

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

Formatters '%c', '%l' and '%k' in function 'formatDateTime' print months and hours without leading zeros.

<h2 id="formatdatetime_parsedatetime_m_is_month_name">
  formatdatetime\_parsedatetime\_m\_is\_month\_name
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.4"},{"label": "1"},{"label": "Improved compatibility with MySQL DATE_FORMAT/STR_TO_DATE"}]}]} />

Formatter '%M' in functions 'formatDateTime' and 'parseDateTime' print/parse the month name instead of minutes.

<h2 id="fsync_metadata">
  fsync\_metadata
</h2>

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

Enables or disables [fsync](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html) when writing `.sql` files. Enabled by default.

It makes sense to disable it if the server has millions of tiny tables that are constantly being created and destroyed.

<h2 id="function_base58_max_input_size">
  function\_base58\_max\_input\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "10000"},{"label": "New setting that limits the input size of `base58Encode`, `base58Decode` and `tryBase58Decode` (whose conversion is quadratic in the input length) to 10 KB by default. The compatibility value `0` disables the limit, restoring the previous behavior of accepting arbitrarily large inputs."}]}]} />

Maximum size, in bytes, of a single input value for the functions `base58Encode`, `base58Decode` and `tryBase58Decode`. The generic `base58` conversion is quadratic in the input length, so a single large value can run for a very long time. `base58` is meant for short data (keys, hashes, addresses), so the default of 10 KB is a generous safety threshold. `base58Encode` and `base58Decode` throw `TOO_LARGE_STRING_SIZE` for larger inputs, while `tryBase58Decode` returns an empty string. A value of `0` disables the limit (the behavior before this setting was introduced). The linear `base32` and `base64` functions are unaffected.

<h2 id="function_date_trunc_return_type_behavior">
  function\_date\_trunc\_return\_type\_behavior
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "0"},{"label": "Add new setting to preserve old behaviour of dateTrunc function"}]}, {"id": "row-2","items": [{"label": "25.4"},{"label": "0"},{"label": "Change the result type for dateTrunc function for DateTime64/Date32 arguments to DateTime64/Date32 regardless of time unit to get correct result for negative values"}]}]} />

Allows to change the behaviour of the result type of `dateTrunc` function.

Possible values:

* 0 - When the second argument is `DateTime64/Date32` the return type will be `DateTime64/Date32` regardless of the time unit in the first argument.
* 1 - For `Date32` the result is always `Date`. For `DateTime64` the result is `DateTime` for time units `second` and higher.

<h2 id="function_implementation">
  function\_implementation
</h2>

Choose function implementation for specific target or variant (experimental). If empty enable all of them.

<h2 id="function_json_value_return_type_allow_complex">
  function\_json\_value\_return\_type\_allow\_complex
</h2>

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

Control whether allow to return complex type (such as: struct, array, map) for json\_value function.

```sql theme={null}
SELECT JSON_VALUE('{"hello":{"world":"!"}}', '$.hello') settings function_json_value_return_type_allow_complex=true

┌─JSON_VALUE('{"hello":{"world":"!"}}', '$.hello')─┐
│ {"world":"!"}                                    │
└──────────────────────────────────────────────────┘

1 row in set. Elapsed: 0.001 sec.
```

Possible values:

* true — Allow.
* false — Disallow.

<h2 id="function_json_value_return_type_allow_nullable">
  function\_json\_value\_return\_type\_allow\_nullable
</h2>

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

Control whether allow to return `NULL` when value is not exist for JSON\_VALUE function.

```sql theme={null}
SELECT JSON_VALUE('{"hello":"world"}', '$.b') settings function_json_value_return_type_allow_nullable=true;

┌─JSON_VALUE('{"hello":"world"}', '$.b')─┐
│ ᴺᵁᴸᴸ                                   │
└────────────────────────────────────────┘

1 row in set. Elapsed: 0.001 sec.
```

Possible values:

* true — Allow.
* false — Disallow.

<h2 id="function_locate_has_mysql_compatible_argument_order">
  function\_locate\_has\_mysql\_compatible\_argument\_order
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "Increase compatibility with MySQL's locate function."}]}]} />

Controls the order of arguments in function [locate](/reference/functions/regular-functions/string-search-functions#locate).

Possible values:

* 0 — Function `locate` accepts arguments `(haystack, needle[, start_pos])`.
* 1 — Function `locate` accepts arguments `(needle, haystack, [, start_pos])` (MySQL-compatible behavior)

<h2 id="function_range_max_elements_in_block">
  function\_range\_max\_elements\_in\_block
</h2>

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

Sets the safety threshold for data volume generated by function [range](/reference/functions/regular-functions/array-functions#range). Defines the maximum number of values generated by function per block of data (sum of array sizes for every row in a block).

Possible values:

* Positive integer.

**See Also**

* [`max_block_size`](#max_block_size)
* [`min_insert_block_size_rows`](#min_insert_block_size_rows)

<h2 id="function_sleep_max_microseconds_per_block">
  function\_sleep\_max\_microseconds\_per\_block
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.7"},{"label": "3000000"},{"label": "In previous versions, the maximum sleep time of 3 seconds was applied only for `sleep`, but not for `sleepEachRow` function. In the new version, we introduce this setting. If you set compatibility with the previous versions, we will disable the limit altogether."}]}]} />

Maximum number of microseconds the function `sleep` is allowed to sleep for each block. If a user called it with a larger value, it throws an exception. It is a safety threshold.

<h2 id="function_visible_width_behavior">
  function\_visible\_width\_behavior
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "1"},{"label": "We changed the default behavior of `visibleWidth` to be more precise"}]}]} />

The version of `visibleWidth` behavior. 0 - only count the number of code points; 1 - correctly count zero-width and combining characters, count full-width characters as two, estimate the tab width, count delete characters.

<h2 id="functions_h3_default_if_invalid">
  functions\_h3\_default\_if\_invalid
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "A new setting for legacy behaviour to allow invalid inputs to h3 functions"}]}]} />

If false, h3 functions, e.g. h3CellAreaM2, throw an exception if input is invalid. If true, they return 0 or default value.

<h2 id="geo_distance_returns_float64_on_float64_arguments">
  geo\_distance\_returns\_float64\_on\_float64\_arguments
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "Increase the default precision."}]}]} />

If all four arguments to `geoDistance`, `greatCircleDistance`, `greatCircleAngle` functions are Float64, return Float64 and use double precision for internal calculations. In previous ClickHouse versions, the functions always returned Float32.

<h2 id="geotoh3_argument_order">
  geotoh3\_argument\_order
</h2>

<SettingsInfoBlock type="GeoToH3ArgumentOrder" default_value="lat_lon" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "lat_lon"},{"label": "A new setting for legacy behaviour to set lon and lat argument order"}]}]} />

Function 'geoToH3' accepts (lon, lat) if set to 'lon\_lat' and (lat, lon) if set to 'lat\_lon'.

<h2 id="glob_expansion_max_elements">
  glob\_expansion\_max\_elements
</h2>

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

Maximum number of allowed addresses (For external storages, table functions, etc).

<h2 id="grace_hash_join_initial_buckets">
  grace\_hash\_join\_initial\_buckets
</h2>

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

Initial number of grace hash join buckets

<h2 id="grace_hash_join_max_buckets">
  grace\_hash\_join\_max\_buckets
</h2>

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

Limit on the number of grace hash join buckets

<h2 id="group_by_overflow_mode">
  group\_by\_overflow\_mode
</h2>

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

Sets what happens when the number of unique keys for aggregation exceeds the limit:

* `throw`: throw an exception
* `break`: stop executing the query and return the partial result
* `any`: continue aggregation for the keys that got into the set, but do not add new keys to the set.

Using the 'any' value lets you run an approximation of GROUP BY. The quality of
this approximation depends on the statistical nature of the data.

<h2 id="group_by_two_level_threshold">
  group\_by\_two\_level\_threshold
</h2>

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

From what number of keys, a two-level aggregation starts. 0 - the threshold is not set.

<h2 id="group_by_two_level_threshold_bytes">
  group\_by\_two\_level\_threshold\_bytes
</h2>

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

From what size of the aggregation state in bytes, a two-level aggregation begins to be used. 0 - the threshold is not set. Two-level aggregation is used when at least one of the thresholds is triggered.

<h2 id="group_by_use_nulls">
  group\_by\_use\_nulls
</h2>

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

Changes the way the [GROUP BY clause](/reference/statements/select/group-by) treats the types of aggregation keys.
When the `ROLLUP`, `CUBE`, or `GROUPING SETS` specifiers are used, some aggregation keys may not be used to produce some result rows.
Columns for these keys are filled with either default value or `NULL` in corresponding rows depending on this setting.

Possible values:

* 0 — The default value for the aggregation key type is used to produce missing values.
* 1 — ClickHouse executes `GROUP BY` the same way as the SQL standard says. The types of aggregation keys are converted to [Nullable](/reference/data-types/nullable). Columns for corresponding aggregation keys are filled with [NULL](/reference/syntax#null) for rows that didn't use it.

See also:

* [GROUP BY clause](/reference/statements/select/group-by)

<h2 id="h3togeo_lon_lat_result_order">
  h3togeo\_lon\_lat\_result\_order
</h2>

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

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

Function 'h3ToGeo' returns (lon, lat) if true, otherwise (lat, lon).

<h2 id="handshake_timeout_ms">
  handshake\_timeout\_ms
</h2>

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

Timeout in milliseconds for receiving Hello packet from replicas during handshake.

<h2 id="hdfs_create_new_file_on_insert">
  hdfs\_create\_new\_file\_on\_insert
</h2>

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

Enables or disables creating a new file on each insert in HDFS engine tables. If enabled, on each insert a new HDFS file will be created with the name, similar to this pattern:

initial: `data.Parquet.gz` -> `data.1.Parquet.gz` -> `data.2.Parquet.gz`, etc.

Possible values:

* 0 — `INSERT` query appends new data to the end of the file.
* 1 — `INSERT` query creates a new file.

<h2 id="hdfs_ignore_file_doesnt_exist">
  hdfs\_ignore\_file\_doesnt\_exist
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "Allow to return 0 rows when the requested files don't exist instead of throwing an exception in HDFS table engine"}]}]} />

Ignore absence of file if it does not exist when reading certain keys.

Possible values:

* 1 — `SELECT` returns empty result.
* 0 — `SELECT` throws an exception.

<h2 id="hdfs_replication">
  hdfs\_replication
</h2>

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

The actual number of replications can be specified when the hdfs file is created.

<h2 id="hdfs_skip_empty_files">
  hdfs\_skip\_empty\_files
</h2>

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

Enables or disables skipping empty files in [HDFS](/reference/engines/table-engines/integrations/hdfs) engine tables.

Possible values:

* 0 — `SELECT` throws an exception if empty file is not compatible with requested format.
* 1 — `SELECT` returns empty result for empty file.

<h2 id="hdfs_throw_on_zero_files_match">
  hdfs\_throw\_on\_zero\_files\_match
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "Allow to throw an error when ListObjects request cannot match any files in HDFS engine instead of empty query result"}]}]} />

Throw an error if matched zero files according to glob expansion rules.

Possible values:

* 1 — `SELECT` throws an exception.
* 0 — `SELECT` returns empty result.

<h2 id="hdfs_truncate_on_insert">
  hdfs\_truncate\_on\_insert
</h2>

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

Enables or disables truncation before an insert in hdfs engine tables. If disabled, an exception will be thrown on an attempt to insert if a file in HDFS already exists.

Possible values:

* 0 — `INSERT` query appends new data to the end of the file.
* 1 — `INSERT` query replaces existing content of the file with the new data.

<h2 id="hedged_connection_timeout_ms">
  hedged\_connection\_timeout\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.4"},{"label": "50"},{"label": "Start new connection in hedged requests after 50 ms instead of 100 to correspond with previous connect timeout"}]}]} />

Connection timeout for establishing connection with replica for Hedged requests

<h2 id="highlight_max_matches_per_row">
  highlight\_max\_matches\_per\_row
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "10000"},{"label": "New setting to limit the number of highlight matches per row to protect against excessive memory usage."}]}]} />

Sets the maximum number of highlight matches per row in the [highlight](/reference/functions/regular-functions/string-search-functions#highlight) function. Use it to protect against excessive memory usage when highlighting highly repetitive patterns in large texts.

Possible values:

* Positive integer.

<h2 id="hnsw_candidate_list_size_for_search">
  hnsw\_candidate\_list\_size\_for\_search
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "256"},{"label": "New setting. Previously, the value was optionally specified in CREATE INDEX and 64 by default."}]}]} />

The size of the dynamic candidate list when searching the vector similarity index, also known as 'ef\_search'.

<h2 id="hsts_max_age">
  hsts\_max\_age
</h2>

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

Expired time for HSTS. 0 means disable HSTS.

<h2 id="http_connection_timeout">
  http\_connection\_timeout
</h2>

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

HTTP connection timeout (in seconds).

Possible values:

* Any positive integer.
* 0 - Disabled (infinite timeout).

<h2 id="http_headers_progress_interval_ms">
  http\_headers\_progress\_interval\_ms
</h2>

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

Do not send HTTP headers X-ClickHouse-Progress more frequently than at each specified interval.

<h2 id="http_headers_read_timeout">
  http\_headers\_read\_timeout
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "30"},{"label": "New setting to limit total time for reading HTTP request headers, protecting against slowloris attacks."}]}]} />

Maximum time in seconds to read all HTTP request headers. This is a total deadline for the entire header parsing phase, not a per-read timeout. Protects against slowloris-style attacks where a client trickles header data slowly to hold connections open.

<h2 id="http_make_head_request">
  http\_make\_head\_request
</h2>

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

The `http_make_head_request` setting allows the execution of a `HEAD` request while reading data from HTTP to retrieve information about the file to be read, such as its size. Since it's enabled by default, it may be desirable to disable this setting in cases where the server does not support `HEAD` requests.

<h2 id="http_max_field_name_size">
  http\_max\_field\_name\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "4096"},{"label": "Reduce default to limit pre-authentication memory usage by HTTP connections."}]}]} />

Maximum length of a field name in HTTP request headers, query parameters, and form data.

<h2 id="http_max_field_value_size">
  http\_max\_field\_value\_size
</h2>

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

Maximum length of a field value in HTTP request headers, query parameters, and form data.

<h2 id="http_max_fields">
  http\_max\_fields
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1000"},{"label": "Reduce default to limit pre-authentication memory usage by HTTP connections."}]}]} />

Maximum number of fields in HTTP request headers, query parameters, and form data.

<h2 id="http_max_multipart_form_data_size">
  http\_max\_multipart\_form\_data\_size
</h2>

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

Limit on size of multipart/form-data content. This setting cannot be parsed from URL parameters and should be set in a user profile. Note that content is parsed and external tables are created in memory before the start of query execution. And this is the only limit that has an effect on that stage (limits on max memory usage and max execution time have no effect while reading HTTP form data).

<h2 id="http_max_request_header_size">
  http\_max\_request\_header\_size
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "10485760"},{"label": "New setting to limit total HTTP request header size before authentication."}]}]} />

Maximum total size of all HTTP request headers (names and values combined) in bytes.

<h2 id="http_max_request_param_data_size">
  http\_max\_request\_param\_data\_size
</h2>

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

Limit on size of request data used as a query parameter in predefined HTTP requests.

<h2 id="http_max_tries">
  http\_max\_tries
</h2>

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

Max attempts to read via http.

<h2 id="http_max_uri_size">
  http\_max\_uri\_size
</h2>

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

Sets the maximum URI length of an HTTP request.

Possible values:

* Positive integer.

<h2 id="http_native_compression_disable_checksumming_on_decompress">
  http\_native\_compression\_disable\_checksumming\_on\_decompress
</h2>

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

Enables or disables checksum verification when decompressing the HTTP POST data from the client. Used only for ClickHouse native compression format (not used with `gzip` or `deflate`).

For more information, read the [HTTP interface description](/concepts/features/interfaces/http).

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="http_receive_timeout">
  http\_receive\_timeout
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.6"},{"label": "30"},{"label": "See http_send_timeout."}]}]} />

HTTP receive timeout (in seconds).

Possible values:

* Any positive integer.
* 0 - Disabled (infinite timeout).

<h2 id="http_response_buffer_size">
  http\_response\_buffer\_size
</h2>

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

The number of bytes to buffer in the server memory before sending a HTTP response to the client or flushing to disk (when http\_wait\_end\_of\_query is enabled).

<h2 id="http_response_headers">
  http\_response\_headers
</h2>

<SettingsInfoBlock type="Map" default_value="{}" />

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

Allows to add or override HTTP headers which the server will return in the response with a successful query result.
This only affects the HTTP interface.

If the header is already set by default, the provided value will override it.
If the header was not set by default, it will be added to the list of headers.
Headers that are set by the server by default and not overridden by this setting, will remain.

The setting allows you to set a header to a constant value. Currently there is no way to set a header to a dynamically calculated value.

Neither names or values can contain ASCII control characters.

If you implement a UI application which allows users to modify settings but at the same time makes decisions based on the returned headers, it is recommended to restrict this setting to readonly.

Example: `SET http_response_headers = '{"Content-Type": "image/png"}'`

<h2 id="http_retry_initial_backoff_ms">
  http\_retry\_initial\_backoff\_ms
</h2>

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

Min milliseconds for backoff, when retrying read via http

<h2 id="http_retry_max_backoff_ms">
  http\_retry\_max\_backoff\_ms
</h2>

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

Max milliseconds for backoff, when retrying read via http

<h2 id="http_send_timeout">
  http\_send\_timeout
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.6"},{"label": "30"},{"label": "3 minutes seems crazy long. Note that this is timeout for a single network write call, not for the whole upload operation."}]}]} />

HTTP send timeout (in seconds).

Possible values:

* Any positive integer.
* 0 - Disabled (infinite timeout).

<Note>
  It's applicable only to the default profile. A server reboot is required for the changes to take effect.
</Note>

<h2 id="http_skip_not_found_url_for_globs">
  http\_skip\_not\_found\_url\_for\_globs
</h2>

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

Skip URLs for globs with HTTP\_NOT\_FOUND error

<h2 id="http_wait_end_of_query">
  http\_wait\_end\_of\_query
</h2>

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

Enable HTTP response buffering on the server-side.

<h2 id="http_write_exception_in_output_format">
  http\_write\_exception\_in\_output\_format
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "0"},{"label": "Changed for consistency across formats"}]}, {"id": "row-2","items": [{"label": "23.9"},{"label": "1"},{"label": "Output valid JSON/XML on exception in HTTP streaming."}]}]} />

Write exception in output format to produce valid output. Works with JSON and XML formats.

<h2 id="http_zlib_compression_level">
  http\_zlib\_compression\_level
</h2>

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

Sets the level of data compression in the response to an HTTP request if [enable\_http\_compression = 1](#enable_http_compression).

Possible values: Numbers from 1 to 9.

<h2 id="iceberg_compaction_data_cleanup">
  iceberg\_compaction\_data\_cleanup
</h2>

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

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

The time after which the data will be deleted.

<h2 id="iceberg_compaction_delay_bias">
  iceberg\_compaction\_delay\_bias
</h2>

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

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

Minimum time of delay between 2 background compaction operations.

<h2 id="iceberg_data_file_size_lower_threshold_compaction">
  iceberg\_data\_file\_size\_lower\_threshold\_compaction
</h2>

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

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

Threshold for compaction data files in iceberg.

<h2 id="iceberg_data_file_size_upper_threshold_compaction">
  iceberg\_data\_file\_size\_upper\_threshold\_compaction
</h2>

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

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

Threshold for compaction data files in iceberg.

<h2 id="iceberg_delete_data_on_drop">
  iceberg\_delete\_data\_on\_drop
</h2>

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

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

Whether to delete all iceberg files on drop or not.

<h2 id="iceberg_expire_default_max_ref_age_ms">
  iceberg\_expire\_default\_max\_ref\_age\_ms
</h2>

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

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

Default value for Iceberg table property `history.expire.max-ref-age-ms` used by `expire_snapshots` when that property is absent.

<h2 id="iceberg_expire_default_max_snapshot_age_ms">
  iceberg\_expire\_default\_max\_snapshot\_age\_ms
</h2>

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

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

Default value for Iceberg table property `history.expire.max-snapshot-age-ms` used by `expire_snapshots` when that property is absent.

<h2 id="iceberg_expire_default_min_snapshots_to_keep">
  iceberg\_expire\_default\_min\_snapshots\_to\_keep
</h2>

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

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

Default value for Iceberg table property `history.expire.min-snapshots-to-keep` used by `expire_snapshots` when that property is absent.

<h2 id="iceberg_insert_max_bytes_in_data_file">
  iceberg\_insert\_max\_bytes\_in\_data\_file
</h2>

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

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

Max bytes of iceberg parquet data file on insert operation.

<h2 id="iceberg_insert_max_partitions">
  iceberg\_insert\_max\_partitions
</h2>

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

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

Max allowed partitions count per one insert operation for Iceberg table engine.

<h2 id="iceberg_insert_max_rows_in_data_file">
  iceberg\_insert\_max\_rows\_in\_data\_file
</h2>

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

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

Max rows of iceberg parquet data file on insert operation.

<h2 id="iceberg_max_number_datafiles_to_compact">
  iceberg\_max\_number\_datafiles\_to\_compact
</h2>

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

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

Threshold for compaction data files in iceberg.

<h2 id="iceberg_metadata_compression_method">
  iceberg\_metadata\_compression\_method
</h2>

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

Method to compress `.metadata.json` file.

<h2 id="iceberg_metadata_log_level">
  iceberg\_metadata\_log\_level
</h2>

<SettingsInfoBlock type="IcebergMetadataLogLevel" default_value="none" />

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

Controls the level of metadata logging for Iceberg tables to system.iceberg\_metadata\_log.
Usually this setting can be modified for debugging purposes.

Possible values:

* none - No metadata log.
* metadata - Root metadata.json file.
* manifest\_list\_metadata - Everything above + metadata from avro manifest list which corresponds to a snapshot.
* manifest\_list\_entry - Everything above + avro manifest list entries.
* manifest\_file\_metadata - Everything above + metadata from traversed avro manifest files.
* manifest\_file\_entry - Everything above + traversed avro manifest files entries.

<h2 id="iceberg_metadata_staleness_ms">
  iceberg\_metadata\_staleness\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "New setting allowing using cached metadata version at READ operations to prevent fetching from remote catalog"}]}]} />

If non-zero, skip fetching iceberg metadata from remote catalog if there is a cached metadata snapshot, more recent than the given staleness window. Zero means to always fetch the latest metadata version from the remote catalog. Setting this a non-zero trades staleness to a lower latency of read operations.

<h2 id="iceberg_orphan_files_older_than_seconds">
  iceberg\_orphan\_files\_older\_than\_seconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "259200"},{"label": "New setting for default orphan file age threshold"}]}]} />

Default age threshold in seconds for orphan file removal in Iceberg tables. Files newer than this are not considered orphans. Used when the older\_than argument is omitted from the remove\_orphan\_files() procedure call. Default is 259200 (3 days).

<h2 id="iceberg_snapshot_id">
  iceberg\_snapshot\_id
</h2>

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

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

Query Iceberg table using the specific snapshot id.

<h2 id="iceberg_timestamp_ms">
  iceberg\_timestamp\_ms
</h2>

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

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

Query Iceberg table using the snapshot that was current at a specific timestamp.

<h2 id="idle_connection_timeout">
  idle\_connection\_timeout
</h2>

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

Timeout to close idle TCP connections after specified number of seconds.

Possible values:

* Positive integer (0 - close immediately, after 0 seconds).

<h2 id="ignore_cold_parts_seconds">
  ignore\_cold\_parts\_seconds
</h2>

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

Only has an effect in ClickHouse Cloud. Exclude new data parts from SELECT queries until they're either pre-warmed (see [cache\_populated\_by\_fetch](/reference/settings/merge-tree-settings#cache_populated_by_fetch)) or this many seconds old. Only for Replicated-/SharedMergeTree.

<h2 id="ignore_data_skipping_indices">
  ignore\_data\_skipping\_indices
</h2>

Ignores the skipping indexes specified if used by the query.

Consider the following example:

```sql theme={null}
CREATE TABLE data
(
    key Int,
    x Int,
    y Int,
    INDEX x_idx x TYPE minmax GRANULARITY 1,
    INDEX y_idx y TYPE minmax GRANULARITY 1,
    INDEX xy_idx (x,y) TYPE minmax GRANULARITY 1
)
Engine=MergeTree()
ORDER BY key;

INSERT INTO data VALUES (1, 2, 3);

SELECT * FROM data;
SELECT * FROM data SETTINGS ignore_data_skipping_indices=''; -- query will produce CANNOT_PARSE_TEXT error.
SELECT * FROM data SETTINGS ignore_data_skipping_indices='x_idx'; -- Ok.
SELECT * FROM data SETTINGS ignore_data_skipping_indices='na_idx'; -- Ok.

SELECT * FROM data WHERE x = 1 AND y = 1 SETTINGS ignore_data_skipping_indices='xy_idx',force_data_skipping_indices='xy_idx' ; -- query will produce INDEX_NOT_USED error, since xy_idx is explicitly ignored.
SELECT * FROM data WHERE x = 1 AND y = 2 SETTINGS ignore_data_skipping_indices='xy_idx';
```

The query without ignoring any indexes:

```sql theme={null}
EXPLAIN indexes = 1 SELECT * FROM data WHERE x = 1 AND y = 2;

Expression ((Projection + Before ORDER BY))
  Filter (WHERE)
    ReadFromMergeTree (default.data)
    Indexes:
      PrimaryKey
        Condition: true
        Parts: 1/1
        Granules: 1/1
      Skip
        Name: x_idx
        Description: minmax GRANULARITY 1
        Parts: 0/1
        Granules: 0/1
      Skip
        Name: y_idx
        Description: minmax GRANULARITY 1
        Parts: 0/0
        Granules: 0/0
      Skip
        Name: xy_idx
        Description: minmax GRANULARITY 1
        Parts: 0/0
        Granules: 0/0
```

Ignoring the `xy_idx` index:

```sql theme={null}
EXPLAIN indexes = 1 SELECT * FROM data WHERE x = 1 AND y = 2 SETTINGS ignore_data_skipping_indices='xy_idx';

Expression ((Projection + Before ORDER BY))
  Filter (WHERE)
    ReadFromMergeTree (default.data)
    Indexes:
      PrimaryKey
        Condition: true
        Parts: 1/1
        Granules: 1/1
      Skip
        Name: x_idx
        Description: minmax GRANULARITY 1
        Parts: 0/1
        Granules: 0/1
      Skip
        Name: y_idx
        Description: minmax GRANULARITY 1
        Parts: 0/0
        Granules: 0/0
```

Works with tables in the MergeTree family.

<h2 id="ignore_drop_queries_probability">
  ignore\_drop\_queries\_probability
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "0"},{"label": "Allow to ignore drop queries in server with specified probability for testing purposes"}]}]} />

If enabled, server will ignore all DROP table queries with specified probability (for Memory and JOIN engines it will replace DROP to TRUNCATE). Used for testing purposes

<h2 id="ignore_format_null_for_explain">
  ignore\_format\_null\_for\_explain
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "FORMAT Null is now ignored for EXPLAIN queries by default"}]}]} />

If enabled, `FORMAT Null` will be ignored for `EXPLAIN` queries and default output format will be used instead.
When disabled, `EXPLAIN` queries with `FORMAT Null` will produce no output (backward compatible behavior).

<h2 id="ignore_materialized_views_with_dropped_target_table">
  ignore\_materialized\_views\_with\_dropped\_target\_table
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "0"},{"label": "Add new setting to allow to ignore materialized views with dropped target table"}]}]} />

Ignore MVs with dropped target table during pushing to views

<h2 id="ignore_on_cluster_for_replicated_access_entities_queries">
  ignore\_on\_cluster\_for\_replicated\_access\_entities\_queries
</h2>

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

Ignore ON CLUSTER clause for replicated access entities management queries.

<h2 id="ignore_on_cluster_for_replicated_database">
  ignore\_on\_cluster\_for\_replicated\_database
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "0"},{"label": "Add a new setting to ignore ON CLUSTER clause for DDL queries with a replicated database."}]}]} />

Always ignore ON CLUSTER clause for DDL queries with replicated databases.

<h2 id="ignore_on_cluster_for_replicated_named_collections_queries">
  ignore\_on\_cluster\_for\_replicated\_named\_collections\_queries
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "0"},{"label": "Ignore ON CLUSTER clause for replicated named collections management queries."}]}]} />

Ignore ON CLUSTER clause for replicated named collections management queries.

<h2 id="ignore_on_cluster_for_replicated_udf_queries">
  ignore\_on\_cluster\_for\_replicated\_udf\_queries
</h2>

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

Ignore ON CLUSTER clause for replicated UDF management queries.

<h2 id="implicit_select">
  implicit\_select
</h2>

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

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

Allow writing simple SELECT queries without the leading SELECT keyword, which makes it simple for calculator-style usage, e.g. `1 + 2` becomes a valid query.

In `clickhouse-local` it is enabled by default and can be explicitly disabled.

<h2 id="implicit_table_at_top_level">
  implicit\_table\_at\_top\_level
</h2>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": ""},{"label": "A new setting, used in clickhouse-local"}]}]} />

If not empty, queries without FROM at the top level will read from this table instead of system.one.

This is used in clickhouse-local for input data processing.
The setting could be set explicitly by a user but is not intended for this type of usage.

Subqueries are not affected by this setting (neither scalar, FROM, or IN subqueries).
SELECTs at the top level of UNION, INTERSECT, EXCEPT chains are treated uniformly and affected by this setting, regardless of their grouping in parentheses.
It is unspecified how this setting affects views and distributed queries.

The setting accepts a table name (then the table is resolved from the current database) or a qualified name in the form of 'database.table'.
Both database and table names have to be unquoted - only simple identifiers are allowed.

<h2 id="implicit_transaction">
  implicit\_transaction
</h2>

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

If enabled and not already inside a transaction, wraps the query inside a full transaction (begin + commit or rollback)

<h2 id="inject_random_order_for_select_without_order_by">
  inject\_random\_order\_for\_select\_without\_order\_by
</h2>

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

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

If enabled, injects 'ORDER BY rand()' into SELECT queries without ORDER BY clause.
Applied only for subquery depth = 0. Subqueries and INSERT INTO ... SELECT are not affected.
If the top-level construct is UNION, 'ORDER BY rand()' is injected into all children independently.
Only useful for testing and development (missing ORDER BY is a source of non-deterministic query results).

<h2 id="insert_allow_materialized_columns">
  insert\_allow\_materialized\_columns
</h2>

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

If setting is enabled, Allow materialized columns in INSERT.

<h2 id="insert_deduplicate">
  insert\_deduplicate
</h2>

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

Enables or disables block deduplication of `INSERT` (for Replicated\* tables).

Possible values:

* 0 — Disabled.
* 1 — Enabled.

By default, blocks inserted into replicated tables by the `INSERT` statement are deduplicated (see [Data Replication](/reference/engines/table-engines/mergetree-family/replication)).
For the replicated tables by default the only 100 of the most recent blocks for each partition are deduplicated (see [replicated\_deduplication\_window](/reference/settings/merge-tree-settings#replicated_deduplication_window), [replicated\_deduplication\_window\_seconds](/reference/settings/merge-tree-settings#replicated_deduplication_window_seconds)).
For not replicated tables see [non\_replicated\_deduplication\_window](/reference/settings/merge-tree-settings#non_replicated_deduplication_window).

<h2 id="insert_deduplication_token">
  insert\_deduplication\_token
</h2>

The setting allows a user to provide own deduplication semantic in MergeTree/ReplicatedMergeTree
For example, by providing a unique value for the setting in each INSERT statement,
user can avoid the same inserted data being deduplicated.

Possible values:

* Any string

`insert_deduplication_token` is used for deduplication *only* when not empty.

For the replicated tables by default the only 100 of the most recent inserts for each partition are deduplicated (see [replicated\_deduplication\_window](/reference/settings/merge-tree-settings#replicated_deduplication_window), [replicated\_deduplication\_window\_seconds](/reference/settings/merge-tree-settings#replicated_deduplication_window_seconds)).
For not replicated tables see [non\_replicated\_deduplication\_window](/reference/settings/merge-tree-settings#non_replicated_deduplication_window).

<Note>
  `insert_deduplication_token` works on a partition level (the same as `insert_deduplication` checksum). Multiple partitions can have the same `insert_deduplication_token`.
</Note>

Example:

```sql theme={null}
CREATE TABLE test_table
( A Int64 )
ENGINE = MergeTree
ORDER BY A
SETTINGS non_replicated_deduplication_window = 100;

INSERT INTO test_table SETTINGS insert_deduplication_token = 'test' VALUES (1);

-- the next insert won't be deduplicated because insert_deduplication_token is different
INSERT INTO test_table SETTINGS insert_deduplication_token = 'test1' VALUES (1);

-- the next insert will be deduplicated because insert_deduplication_token
-- is the same as one of the previous
INSERT INTO test_table SETTINGS insert_deduplication_token = 'test' VALUES (2);

SELECT * FROM test_table

┌─A─┐
│ 1 │
└───┘
┌─A─┐
│ 1 │
└───┘
```

<h2 id="insert_keeper_fault_injection_probability">
  insert\_keeper\_fault\_injection\_probability
</h2>

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

Approximate probability of failure for a keeper request during insert. Valid value is in interval \[0.0f, 1.0f]

<h2 id="insert_keeper_fault_injection_seed">
  insert\_keeper\_fault\_injection\_seed
</h2>

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

0 - random seed, otherwise the setting value

<h2 id="insert_keeper_max_retries">
  insert\_keeper\_max\_retries
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.2"},{"label": "20"},{"label": "Enable reconnections to Keeper on INSERT, improve reliability"}]}]} />

The setting sets the maximum number of retries for ClickHouse Keeper (or ZooKeeper) requests during insert into replicated MergeTree. Only Keeper requests which failed due to network error, Keeper session timeout, or request timeout are considered for retries.

Possible values:

* Positive integer.
* 0 — Retries are disabled

Cloud default value: `20`.

Keeper request retries are done after some timeout. The timeout is controlled by the following settings: `insert_keeper_retry_initial_backoff_ms`, `insert_keeper_retry_max_backoff_ms`.
The first retry is done after `insert_keeper_retry_initial_backoff_ms` timeout. The consequent timeouts will be calculated as follows:

```
timeout = min(insert_keeper_retry_max_backoff_ms, latest_timeout * 2)
```

For example, if `insert_keeper_retry_initial_backoff_ms=100`, `insert_keeper_retry_max_backoff_ms=10000` and `insert_keeper_max_retries=8` then timeouts will be `100, 200, 400, 800, 1600, 3200, 6400, 10000`.

Apart from fault tolerance, the retries aim to provide a better user experience - they allow to avoid returning an error during INSERT execution if Keeper is restarted, for example, due to an upgrade.

<h2 id="insert_keeper_retry_initial_backoff_ms">
  insert\_keeper\_retry\_initial\_backoff\_ms
</h2>

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

Initial timeout(in milliseconds) to retry a failed Keeper request during INSERT query execution

Possible values:

* Positive integer.
* 0 — No timeout

<h2 id="insert_keeper_retry_max_backoff_ms">
  insert\_keeper\_retry\_max\_backoff\_ms
</h2>

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

Maximum timeout (in milliseconds) to retry a failed Keeper request during INSERT query execution

Possible values:

* Positive integer.
* 0 — Maximum timeout is not limited

<h2 id="insert_null_as_default">
  insert\_null\_as\_default
</h2>

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

Enables or disables the insertion of [default values](/reference/statements/create/table#default_values) instead of [NULL](/reference/syntax#null) into columns with not [nullable](/reference/data-types/nullable) data type.
If column type is not nullable and this setting is disabled, then inserting `NULL` causes an exception. If column type is nullable, then `NULL` values are inserted as is, regardless of this setting.

This setting is applicable to [INSERT ... SELECT](/reference/statements/insert-into#inserting-the-results-of-select) queries. Note that `SELECT` subqueries may be concatenated with `UNION ALL` clause.

Possible values:

* 0 — Inserting `NULL` into a not nullable column causes an exception.
* 1 — Default column value is inserted instead of `NULL`.

<h2 id="insert_quorum">
  insert\_quorum
</h2>

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

<Note>
  This setting is not applicable to SharedMergeTree, see [SharedMergeTree consistency](/products/cloud/features/infrastructure/shared-merge-tree#consistency) for more information.
</Note>

Enables the quorum writes.

* If `insert_quorum < 2`, the quorum writes are disabled.
* If `insert_quorum >= 2`, the quorum writes are enabled.
* If `insert_quorum = 'auto'`, use majority number (`number_of_replicas / 2 + 1`) as quorum number.

Quorum writes

`INSERT` succeeds only when ClickHouse manages to correctly write data to the `insert_quorum` of replicas during the `insert_quorum_timeout`. If for any reason the number of replicas with successful writes does not reach the `insert_quorum`, the write is considered failed and ClickHouse will delete the inserted block from all the replicas where data has already been written.

When `insert_quorum_parallel` is disabled, all replicas in the quorum are consistent, i.e. they contain data from all previous `INSERT` queries (the `INSERT` sequence is linearized). When reading data written using `insert_quorum` and `insert_quorum_parallel` is disabled, you can turn on sequential consistency for `SELECT` queries using [select\_sequential\_consistency](#select_sequential_consistency).

ClickHouse generates an exception:

* If the number of available replicas at the time of the query is less than the `insert_quorum`.
* When `insert_quorum_parallel` is disabled and an attempt to write data is made when the previous block has not yet been inserted in `insert_quorum` of replicas. This situation may occur if the user tries to perform another `INSERT` query to the same table before the previous one with `insert_quorum` is completed.

See also:

* [insert\_quorum\_timeout](#insert_quorum_timeout)
* [insert\_quorum\_parallel](#insert_quorum_parallel)
* [select\_sequential\_consistency](#select_sequential_consistency)

<h2 id="insert_quorum_parallel">
  insert\_quorum\_parallel
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.1"},{"label": "1"},{"label": "Use parallel quorum inserts by default. It is significantly more convenient to use than sequential quorum inserts"}]}]} />

<Note>
  This setting is not applicable to SharedMergeTree, see [SharedMergeTree consistency](/products/cloud/features/infrastructure/shared-merge-tree#consistency) for more information.
</Note>

Enables or disables parallelism for quorum `INSERT` queries. If enabled, additional `INSERT` queries can be sent while previous queries have not yet finished. If disabled, additional writes to the same table will be rejected.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

See also:

* [insert\_quorum](#insert_quorum)
* [insert\_quorum\_timeout](#insert_quorum_timeout)
* [select\_sequential\_consistency](#select_sequential_consistency)

<h2 id="insert_quorum_timeout">
  insert\_quorum\_timeout
</h2>

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

Write to a quorum timeout in milliseconds. If the timeout has passed and no write has taken place yet, ClickHouse will generate an exception and the client must repeat the query to write the same block to the same or any other replica.

See also:

* [insert\_quorum](#insert_quorum)
* [insert\_quorum\_parallel](#insert_quorum_parallel)
* [select\_sequential\_consistency](#select_sequential_consistency)

<h2 id="insert_shard_id">
  insert\_shard\_id
</h2>

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

If not `0`, specifies the shard of [Distributed](/reference/engines/table-engines/special/distributed) table into which the data will be inserted synchronously.

If `insert_shard_id` value is incorrect, the server will throw an exception.

To get the number of shards on `requested_cluster`, you can check server config or use this query:

```sql theme={null}
SELECT uniq(shard_num) FROM system.clusters WHERE cluster = 'requested_cluster';
```

Possible values:

* 0 — Disabled.
* Any number from `1` to `shards_num` of corresponding [Distributed](/reference/engines/table-engines/special/distributed) table.

**Example**

Query:

```sql theme={null}
CREATE TABLE x AS system.numbers ENGINE = MergeTree ORDER BY number;
CREATE TABLE x_dist AS x ENGINE = Distributed('test_cluster_two_shards_localhost', currentDatabase(), x);
INSERT INTO x_dist SELECT * FROM numbers(5) SETTINGS insert_shard_id = 1;
SELECT * FROM x_dist ORDER BY number ASC;
```

Result:

```text theme={null}
┌─number─┐
│      0 │
│      0 │
│      1 │
│      1 │
│      2 │
│      2 │
│      3 │
│      3 │
│      4 │
│      4 │
└────────┘
```

<h2 id="interactive_delay">
  interactive\_delay
</h2>

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

The interval in microseconds for checking whether request execution has been canceled and sending the progress.

<h2 id="intersect_default_mode">
  intersect\_default\_mode
</h2>

<SettingsInfoBlock type="SetOperationMode" default_value="ALL" />

Set default mode in INTERSECT query. Possible values: empty string, 'ALL', 'DISTINCT'. If empty, query without mode will throw exception.

<h2 id="jemalloc_collect_profile_samples_in_trace_log">
  jemalloc\_collect\_profile\_samples\_in\_trace\_log
</h2>

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

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

Collect jemalloc allocation and deallocation samples in trace log.

<h2 id="jemalloc_enable_profiler">
  jemalloc\_enable\_profiler
</h2>

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

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

Enable jemalloc profiler for the query. Jemalloc will sample allocations and all deallocations for sampled allocations.
Profiles can be flushed using SYSTEM JEMALLOC FLUSH PROFILE which can be used for allocation analysis.
Samples can also be stored in system.trace\_log using config jemalloc\_collect\_global\_profile\_samples\_in\_trace\_log or with query setting jemalloc\_collect\_profile\_samples\_in\_trace\_log.
See [Allocation Profiling](/concepts/features/performance/allocation-profiling)

<h2 id="jemalloc_profile_text_collapsed_use_count">
  jemalloc\_profile\_text\_collapsed\_use\_count
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "New setting to aggregate by allocation count instead of bytes in the collapsed jemalloc heap profile format"}]}]} />

When using the 'collapsed' output format for jemalloc heap profile, aggregate by allocation count instead of bytes. When false (default), each stack is weighted by live bytes; when true, by live allocation count.

<h2 id="jemalloc_profile_text_output_format">
  jemalloc\_profile\_text\_output\_format
</h2>

<SettingsInfoBlock type="JemallocProfileFormat" default_value="collapsed" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "collapsed"},{"label": "New setting to control output format for system.jemalloc_profile_text table. Possible values: 'raw', 'symbolized', 'collapsed'"}]}]} />

Output format for jemalloc heap profile in system.jemalloc\_profile\_text table. Can be: 'raw' (raw profile), 'symbolized' (jeprof format with symbols), or 'collapsed' (FlameGraph format).

<h2 id="jemalloc_profile_text_symbolize_with_inline">
  jemalloc\_profile\_text\_symbolize\_with\_inline
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "New setting to control whether to include inline frames when symbolizing jemalloc heap profile. When enabled, inline frames are included at the cost of slower symbolization; when disabled, they are skipped for faster output"}]}]} />

Whether to include inline frames when symbolizing jemalloc heap profile. When enabled, inline frames are included which can slow down symbolization process drastically; when disabled, they are skipped. Only affects 'symbolized' and 'collapsed' output formats.

<h2 id="join_algorithm">
  join\_algorithm
</h2>

<SettingsInfoBlock type="JoinAlgorithm" default_value="direct,parallel_hash,hash" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.12"},{"label": "direct,parallel_hash,hash"},{"label": "'default' was deprecated in favor of explicitly specified join algorithms, also parallel_hash is now preferred over hash"}]}]} />

Specifies which [JOIN](/reference/statements/select/join) algorithm is used.

Several algorithms can be specified, and an available one would be chosen for a particular query based on kind/strictness and table engine.

Possible values:

* grace\_hash

[Grace hash join](https://en.wikipedia.org/wiki/Hash_join#Grace_hash_join) is used.  Grace hash provides an algorithm option that provides performant complex joins while limiting memory use.

The first phase of a grace join reads the right table and splits it into N buckets depending on the hash value of key columns (initially, N is `grace_hash_join_initial_buckets`). This is done in a way to ensure that each bucket can be processed independently. Rows from the first bucket are added to an in-memory hash table while the others are saved to disk. If the hash table grows beyond the memory limit (e.g., as set by [`max_bytes_in_join`](/reference/settings/session-settings#max_bytes_in_join), the number of buckets is increased and the assigned bucket for each row. Any rows which don't belong to the current bucket are flushed and reassigned.

Supports `INNER/LEFT/RIGHT/FULL ALL/ANY JOIN`.

* hash

[Hash join algorithm](https://en.wikipedia.org/wiki/Hash_join) is used. The most generic implementation that supports all combinations of kind and strictness and multiple join keys that are combined with `OR` in the `JOIN ON` section.

When using the `hash` algorithm, the right part of `JOIN` is uploaded into RAM.

* parallel\_hash

A variation of `hash` join that splits the data into buckets and builds several hashtables instead of one concurrently to speed up this process.

When using the `parallel_hash` algorithm, the right part of `JOIN` is uploaded into RAM.

* partial\_merge

A variation of the [sort-merge algorithm](https://en.wikipedia.org/wiki/Sort-merge_join), where only the right table is fully sorted.

The `RIGHT JOIN` and `FULL JOIN` are supported only with `ALL` strictness (`SEMI`, `ANTI`, `ANY`, and `ASOF` are not supported).

When using the `partial_merge` algorithm, ClickHouse sorts the data and dumps it to the disk. The `partial_merge` algorithm in ClickHouse differs slightly from the classic realization. First, ClickHouse sorts the right table by joining keys in blocks and creates a min-max index for sorted blocks. Then it sorts parts of the left table by the `join key` and joins them over the right table. The min-max index is also used to skip unneeded right table blocks.

* direct

The `direct` (also known as nested loop) algorithm performs a lookup in the right table using rows from the left table as keys.
It's supported by special storages such as [Dictionary](/reference/engines/table-engines/special/dictionary), [EmbeddedRocksDB](/reference/engines/table-engines/integrations/embedded-rocksdb), and [MergeTree](/reference/engines/table-engines/mergetree-family/mergetree) tables.

For MergeTree tables, the algorithm pushes join key filters directly to the storage layer. This can be more efficient when the key can use the table's primary key index for lookups, otherwise it performs full scans of the right table for each left table block.

Supports `INNER` and `LEFT` joins and only single-column equality join keys without other conditions.

* auto

When set to `auto`, `hash` join is tried first, and the algorithm is switched on the fly to another algorithm if the memory limit is violated.

* full\_sorting\_merge

[Sort-merge algorithm](https://en.wikipedia.org/wiki/Sort-merge_join) with full sorting of joined tables before joining.

* prefer\_partial\_merge

ClickHouse always tries to use `partial_merge` join if possible, otherwise, it uses `hash`. *Deprecated*, same as `partial_merge,hash`.

* default (deprecated)

Legacy value, please don't use anymore.
Same as `direct,hash`, i.e. try to use direct join and hash join (in this order).

<h2 id="join_any_take_last_row">
  join\_any\_take\_last\_row
</h2>

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

Changes the behaviour of join operations with `ANY` strictness.

<Note>
  This setting applies only for `JOIN` operations with [Join](/reference/engines/table-engines/special/join) engine tables.
</Note>

Possible values:

* 0 — If the right table has more than one matching row, only the first one found is joined.
* 1 — If the right table has more than one matching row, only the last one found is joined.

See also:

* [JOIN clause](/reference/statements/select/join)
* [Join table engine](/reference/engines/table-engines/special/join)
* [join\_default\_strictness](#join_default_strictness)

<h2 id="join_default_strictness">
  join\_default\_strictness
</h2>

<SettingsInfoBlock type="JoinStrictness" default_value="ALL" />

Sets default strictness for [JOIN clauses](/reference/statements/select/join).

Possible values:

* `ALL` — If the right table has several matching rows, ClickHouse creates a [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) from matching rows. This is the normal `JOIN` behaviour from standard SQL.
* `ANY` — If the right table has several matching rows, only the first one found is joined. If the right table has only one matching row, the results of `ANY` and `ALL` are the same.
* `ASOF` — For joining sequences with an uncertain match.
* `Empty string` — If `ALL` or `ANY` is not specified in the query, ClickHouse throws an exception.

<h2 id="join_on_disk_max_files_to_merge">
  join\_on\_disk\_max\_files\_to\_merge
</h2>

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

Limits the number of files allowed for parallel sorting in MergeJoin operations when they are executed on disk.

The bigger the value of the setting, the more RAM is used and the less disk I/O is needed.

Possible values:

* Any positive integer, starting from 2.

<h2 id="join_output_by_rowlist_perkey_rows_threshold">
  join\_output\_by\_rowlist\_perkey\_rows\_threshold
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "5"},{"label": "The lower limit of per-key average rows in the right table to determine whether to output by row list in hash join."}]}]} />

The lower limit of per-key average rows in the right table to determine whether to output by row list in hash join.

<h2 id="join_overflow_mode">
  join\_overflow\_mode
</h2>

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

Defines what action ClickHouse performs when a join reaches any of the following limits:

* [max\_bytes\_in\_join](/reference/settings/session-settings#max_bytes_in_join)
* [max\_rows\_in\_join](/reference/settings/session-settings#max_rows_in_join)

This setting is honored only by the `hash` and `parallel_hash`
[`join_algorithm`](/reference/settings/session-settings#join_algorithm) values. Other
algorithms (for example, `partial_merge`, `grace_hash`, `auto`) handle the
limits differently — by spilling to disk, re-partitioning, or switching
strategy — see
[`join_algorithm`](/reference/settings/session-settings#join_algorithm).

Possible values:

* `THROW` — ClickHouse throws an exception and stops the query.
* `BREAK` — ClickHouse stops the query and does not throw an exception.

Default value: `THROW`.

**See Also**

* [JOIN clause](/reference/statements/select/join)
* [Join table engine](/reference/engines/table-engines/special/join)

<h2 id="join_runtime_bloom_filter_bytes">
  join\_runtime\_bloom\_filter\_bytes
</h2>

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

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

Size in bytes of a bloom filter used as JOIN runtime filter (see enable\_join\_runtime\_filters setting).

<h2 id="join_runtime_bloom_filter_hash_functions">
  join\_runtime\_bloom\_filter\_hash\_functions
</h2>

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

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

Number of hash functions in a bloom filter used as JOIN runtime filter (see enable\_join\_runtime\_filters setting).

<h2 id="join_runtime_bloom_filter_max_ratio_of_set_bits">
  join\_runtime\_bloom\_filter\_max\_ratio\_of\_set\_bits
</h2>

<SettingsInfoBlock type="Double" default_value="0.7" />

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

If the number of set bits in a runtime bloom filter exceeds this ratio the filter is completely disabled to reduce the overhead.

<h2 id="join_runtime_filter_blocks_to_skip_before_reenabling">
  join\_runtime\_filter\_blocks\_to\_skip\_before\_reenabling
</h2>

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

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

Number of blocks that are skipped before trying to dynamically re-enable a runtime filter that previously was disabled due to poor filtering ratio.

<h2 id="join_runtime_filter_exact_values_limit">
  join\_runtime\_filter\_exact\_values\_limit
</h2>

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

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

Maximum number of elements in runtime filter that are stored as is in a set, when this threshold is exceeded it switches to bloom filter.

<h2 id="join_runtime_filter_from_fixed_hash_table">
  join\_runtime\_filter\_from\_fixed\_hash\_table
</h2>

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

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

When the hash join build side was converted to a FixedHashMap (see `enable_join_fixed_hash_table_conversion`), use that hash map directly as the runtime filter.

<h2 id="join_runtime_filter_pass_ratio_threshold_for_disabling">
  join\_runtime\_filter\_pass\_ratio\_threshold\_for\_disabling
</h2>

<SettingsInfoBlock type="Double" default_value="0.7" />

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

If ratio of passed rows to checked rows is greater than this threshold the runtime filter is considered as poorly performing and is disabled for the next `join_runtime_filter_blocks_to_skip_before_reenabling` blocks to reduce the overhead.

<h2 id="join_to_sort_maximum_table_rows">
  join\_to\_sort\_maximum\_table\_rows
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "10000"},{"label": "The maximum number of rows in the right table to determine whether to rerange the right table by key in left or inner join"}]}]} />

The maximum number of rows in the right table to determine whether to rerange the right table by key in left or inner join.

<h2 id="join_to_sort_minimum_perkey_rows">
  join\_to\_sort\_minimum\_perkey\_rows
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "40"},{"label": "The lower limit of per-key average rows in the right table to determine whether to rerange the right table by key in left or inner join. This setting ensures that the optimization is not applied for sparse table keys"}]}]} />

The lower limit of per-key average rows in the right table to determine whether to rerange the right table by key in left or inner join. This setting ensures that the optimization is not applied for sparse table keys

<h2 id="join_use_nulls">
  join\_use\_nulls
</h2>

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

Sets the type of [JOIN](/reference/statements/select/join) behaviour. When merging tables, empty cells may appear. ClickHouse fills them differently based on this setting.

Possible values:

* 0 — The empty cells are filled with the default value of the corresponding field type.
* 1 — `JOIN` behaves the same way as in standard SQL. The type of the corresponding field is converted to [Nullable](/reference/data-types/nullable), and empty cells are filled with [NULL](/reference/syntax).

<h2 id="joined_block_split_single_row">
  joined\_block\_split\_single\_row
</h2>

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

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

Allow to chunk hash join result by rows corresponding to single row from left table.
This may reduce memory usage in case of row with many matches in right table, but may increase CPU usage.
Note that `max_joined_block_size_rows != 0` is mandatory for this setting to have effect.
The `max_joined_block_size_bytes` combined with this setting is helpful to avoid excessive memory usage in case of skewed data with some large rows having many matches in right table.

<h2 id="joined_subquery_requires_alias">
  joined\_subquery\_requires\_alias
</h2>

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

Force joined subqueries and table functions to have aliases for correct name qualification.

<h2 id="kafka_disable_num_consumers_limit">
  kafka\_disable\_num\_consumers\_limit
</h2>

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

Disable limit on kafka\_num\_consumers that depends on the number of available CPU cores.

<h2 id="kafka_max_wait_ms">
  kafka\_max\_wait\_ms
</h2>

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

The wait time in milliseconds for reading messages from [Kafka](/reference/engines/table-engines/integrations/kafka) before retry.

Possible values:

* Positive integer.
* 0 — Infinite timeout.

See also:

* [Apache Kafka](https://kafka.apache.org/)

<h2 id="keeper_map_strict_mode">
  keeper\_map\_strict\_mode
</h2>

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

Enforce additional checks during operations on KeeperMap. E.g. throw an exception on an insert for already existing key

<h2 id="keeper_max_retries">
  keeper\_max\_retries
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "10"},{"label": "Max retries for general keeper operations"}]}]} />

Max retries for general keeper operations

<h2 id="keeper_retry_initial_backoff_ms">
  keeper\_retry\_initial\_backoff\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "100"},{"label": "Initial backoff timeout for general keeper operations"}]}]} />

Initial backoff timeout for general keeper operations

<h2 id="keeper_retry_max_backoff_ms">
  keeper\_retry\_max\_backoff\_ms
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "5000"},{"label": "Max backoff timeout for general keeper operations"}]}]} />

Max backoff timeout for general keeper operations

<h2 id="least_greatest_legacy_null_behavior">
  least\_greatest\_legacy\_null\_behavior
</h2>

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

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

If enabled, functions 'least' and 'greatest' return NULL if one of their arguments is NULL.

<h2 id="legacy_column_name_of_tuple_literal">
  legacy\_column\_name\_of\_tuple\_literal
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.7"},{"label": "0"},{"label": "Add this setting only for compatibility reasons. It makes sense to set to 'true', while doing rolling update of cluster from version lower than 21.7 to higher"}]}]} />

List all names of element of large tuple literals in their column names instead of hash. This settings exists only for compatibility reasons. It makes sense to set to 'true', while doing rolling update of cluster from version lower than 21.7 to higher.

<h2 id="lightweight_delete_mode">
  lightweight\_delete\_mode
</h2>

<SettingsInfoBlock type="LightweightDeleteMode" default_value="alter_update" />

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

A mode of internal update query that is executed as a part of lightweight delete.

Possible values:

* `alter_update` - run `ALTER UPDATE` query that creates a heavyweight mutation.
* `lightweight_update` - run lightweight update if possible, run `ALTER UPDATE` otherwise.
* `lightweight_update_force` - run lightweight update if possible, throw otherwise.

<h2 id="lightweight_deletes_sync">
  lightweight\_deletes\_sync
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "2"},{"label": "The same as 'mutation_sync', but controls only execution of lightweight deletes"}]}]} />

The same as [`mutations_sync`](#mutations_sync), but controls only execution of lightweight deletes.

Possible values:

| Value | Description                                                                                                                                            |
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `0`   | Mutations execute asynchronously.                                                                                                                      |
| `1`   | The query waits for the lightweight deletes to complete on the current server.                                                                         |
| `2`   | The query waits for the lightweight deletes to complete on all replicas (if they exist).                                                               |
| `3`   | The query waits only for active replicas. Supported only for `SharedMergeTree`. For `ReplicatedMergeTree` it behaves the same as `mutations_sync = 2`. |

**See Also**

* [Synchronicity of ALTER Queries](/reference/statements/alter/index#synchronicity-of-alter-queries)
* [Mutations](/reference/statements/alter/index#mutations)

Cloud default value: `1`.

<h2 id="limit">
  limit
</h2>

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

Sets the maximum number of rows to get from the query result. It adjusts the value set by the [LIMIT](/reference/statements/select/limit) clause, so that the limit, specified in the query, cannot exceed the limit, set by this setting.

Possible values:

* 0 — The number of rows is not limited.
* Positive integer.

<h2 id="load_balancing">
  load\_balancing
</h2>

<SettingsInfoBlock type="LoadBalancing" default_value="random" />

Specifies the algorithm of replicas selection that is used for distributed query processing.

ClickHouse supports the following algorithms of choosing replicas:

* [Random](#load_balancing-random) (by default)
* [Nearest hostname](#load_balancing-nearest_hostname)
* [Hostname levenshtein distance](#load_balancing-hostname_levenshtein_distance)
* [Hostname longest common prefix](#load_balancing-hostname_longest_common_prefix)
* [Hostname longest common suffix](#load_balancing-hostname_longest_common_suffix)
* [In order](#load_balancing-in_order)
* [First or random](#load_balancing-first_or_random)
* [Round robin](#load_balancing-round_robin)

See also:

* [distributed\_replica\_max\_ignored\_errors](#distributed_replica_max_ignored_errors)

<h3 id="load_balancing-random">
  Random (by Default)
</h3>

```sql theme={null}
load_balancing = random
```

The number of errors is counted for each replica. The query is sent to the replica with the fewest errors, and if there are several of these, to anyone of them.
Disadvantages: Server proximity is not accounted for; if the replicas have different data, you will also get different data.

<h3 id="load_balancing-nearest_hostname">
  Nearest Hostname
</h3>

```sql theme={null}
load_balancing = nearest_hostname
```

The number of errors is counted for each replica. Every 5 minutes, the number of errors is integrally divided by 2. Thus, the number of errors is calculated for a recent time with exponential smoothing. If there is one replica with a minimal number of errors (i.e. errors occurred recently on the other replicas), the query is sent to it. If there are multiple replicas with the same minimal number of errors, the query is sent to the replica with a hostname that is most similar to the server's hostname in the config file (for the number of different characters in identical positions, up to the minimum length of both hostnames).

For instance, example01-01-1 and example01-01-2 are different in one position, while example01-01-1 and example01-02-2 differ in two places.
This method might seem primitive, but it does not require external data about network topology, and it does not compare IP addresses, which would be complicated for our IPv6 addresses.

Thus, if there are equivalent replicas, the closest one by name is preferred.
We can also assume that when sending a query to the same server, in the absence of failures, a distributed query will also go to the same servers. So even if different data is placed on the replicas, the query will return mostly the same results.

<h3 id="load_balancing-hostname_levenshtein_distance">
  Hostname levenshtein distance
</h3>

```sql theme={null}
load_balancing = hostname_levenshtein_distance
```

Just like `nearest_hostname`, but it compares hostname in a [levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) manner. For example:

```text theme={null}
example-clickhouse-0-0 ample-clickhouse-0-0
1

example-clickhouse-0-0 example-clickhouse-1-10
2

example-clickhouse-0-0 example-clickhouse-12-0
3
```

<h3 id="load_balancing-hostname_longest_common_prefix">
  Hostname longest common prefix
</h3>

```sql theme={null}
load_balancing = hostname_longest_common_prefix
```

Just like `nearest_hostname`, but the replica whose hostname shares the longest common prefix with the local hostname is preferred (the longer the common prefix, the higher the priority). Unlike `nearest_hostname`, which counts differing characters position by position, this strategy is not confused by hostnames whose numeric segments have different lengths. For example, for the local hostname `sfe301`:

```text theme={null}
sfe301 sde301
1

sfe301 sfe10101
3

sfe301 sde505
1
```

Here `sfe10101` is preferred because it shares the longest common prefix (`sfe`, length 3) with `sfe301`.

Replicas with equal common prefix length are chosen at random. In particular, when no replica shares any prefix with the local hostname (all common prefix lengths are zero), this strategy behaves exactly like `random`.

<h3 id="load_balancing-hostname_longest_common_suffix">
  Hostname longest common suffix
</h3>

```sql theme={null}
load_balancing = hostname_longest_common_suffix
```

Just like `hostname_longest_common_prefix`, but the longest common *suffix* is compared instead of the prefix. This is useful when the data center identity is encoded as a suffix of the hostname. For example, for the local hostname `et46gtghn.qc.localdomain`:

```text theme={null}
et46gtghn.qc.localdomain tr676ddgh.td.localdomain
12

et46gtghn.qc.localdomain ab999.qc.localdomain
15
```

Here `ab999.qc.localdomain` is preferred because it shares the longest common suffix (`.qc.localdomain`, length 15) with `et46gtghn.qc.localdomain`.

Replicas with equal common suffix length are chosen at random. In particular, when no replica shares any suffix with the local hostname (all common suffix lengths are zero), this strategy behaves exactly like `random`.

<h3 id="load_balancing-in_order">
  In Order
</h3>

```sql theme={null}
load_balancing = in_order
```

Replicas with the same number of errors are accessed in the same order as they are specified in the configuration.
This method is appropriate when you know exactly which replica is preferable.

<h3 id="load_balancing-first_or_random">
  First or Random
</h3>

```sql theme={null}
load_balancing = first_or_random
```

This algorithm chooses the first replica in the set or a random replica if the first is unavailable. It's effective in cross-replication topology setups, but useless in other configurations.

The `first_or_random` algorithm solves the problem of the `in_order` algorithm. With `in_order`, if one replica goes down, the next one gets a double load while the remaining replicas handle the usual amount of traffic. When using the `first_or_random` algorithm, the load is evenly distributed among replicas that are still available.

It's possible to explicitly define what the first replica is by using the setting `load_balancing_first_offset`. This gives more control to rebalance query workloads among replicas.

<h3 id="load_balancing-round_robin">
  Round Robin
</h3>

```sql theme={null}
load_balancing = round_robin
```

This algorithm uses a round-robin policy across replicas with the same number of errors (only the queries with `round_robin` policy is accounted).

<h2 id="load_balancing_first_offset">
  load\_balancing\_first\_offset
</h2>

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

Which replica to preferably send a query when FIRST\_OR\_RANDOM load balancing strategy is used.

<h2 id="load_marks_asynchronously">
  load\_marks\_asynchronously
</h2>

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

Load MergeTree marks asynchronously

Cloud default value: `1`.

<h2 id="local_filesystem_read_method">
  local\_filesystem\_read\_method
</h2>

<SettingsInfoBlock type="String" default_value="pread_threadpool" />

Method of reading data from local filesystem, one of: read, pread, mmap, io\_uring, pread\_threadpool.

The 'io\_uring' method is experimental and does not work for Log, TinyLog, StripeLog, File, Set and Join, and other tables with append-able files in presence of concurrent reads and writes.
If you read various articles about 'io\_uring' on the Internet, don't be blinded by them. It is not a better method of reading files, unless the case of a large amount of small IO requests, which is not the case in ClickHouse. There are no reasons to enable 'io\_uring'.

<h2 id="local_filesystem_read_prefetch">
  local\_filesystem\_read\_prefetch
</h2>

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

Should use prefetching when reading data from local filesystem.

<h2 id="lock_acquire_timeout">
  lock\_acquire\_timeout
</h2>

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

Defines how many seconds a locking request waits before failing.

Locking timeout is used to protect from deadlocks while executing read/write operations with tables. When the timeout expires and the locking request fails, the ClickHouse server throws an exception "Locking attempt timed out! Possible deadlock avoided. Client should retry." with error code `DEADLOCK_AVOIDED`.

Possible values:

* Positive integer (in seconds).
* 0 — No locking timeout.

<h2 id="log_comment">
  log\_comment
</h2>

Specifies the value for the `log_comment` field of the [system.query\_log](/reference/system-tables/query_log) table and comment text for the server log.

It can be used to improve the readability of server logs. Additionally, it helps to select queries related to the test from the `system.query_log` after running [clickhouse-test](/resources/develop-contribute/contribute/tests).

Possible values:

* Any string no longer than [max\_query\_size](#max_query_size). If the max\_query\_size is exceeded, the server throws an exception.

**Example**

Query:

```sql theme={null}
SET log_comment = 'log_comment test', log_queries = 1;
SELECT 1;
SYSTEM FLUSH LOGS;
SELECT type, query FROM system.query_log WHERE log_comment = 'log_comment test' AND event_date >= yesterday() ORDER BY event_time DESC LIMIT 2;
```

Result:

```text theme={null}
┌─type────────┬─query─────┐
│ QueryStart  │ SELECT 1; │
│ QueryFinish │ SELECT 1; │
└─────────────┴───────────┘
```

<h2 id="log_formatted_queries">
  log\_formatted\_queries
</h2>

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

Allows to log formatted queries to the [system.query\_log](/reference/system-tables/query_log) system table (populates `formatted_query` column in the [system.query\_log](/reference/system-tables/query_log)).

Possible values:

* 0 — Formatted queries are not logged in the system table.
* 1 — Formatted queries are logged in the system table.

<h2 id="log_processors_profiles">
  log\_processors\_profiles
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "Enable by default"}]}]} />

Write time that processor spent during execution/waiting for data to `system.processors_profile_log` table.

See also:

* [`system.processors_profile_log`](/reference/system-tables/processors_profile_log)
* [`EXPLAIN PIPELINE`](/reference/statements/explain#explain-pipeline)

<h2 id="log_profile_events">
  log\_profile\_events
</h2>

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

Log query performance statistics into the query\_log, query\_thread\_log and query\_views\_log.

<h2 id="log_queries">
  log\_queries
</h2>

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

Setting up query logging.

Queries sent to ClickHouse with this setup are logged according to the rules in the [query\_log](/reference/settings/server-settings/settings#query_log) server configuration parameter.

Example:

```text theme={null}
log_queries=1
```

<h2 id="log_queries_cut_to_length">
  log\_queries\_cut\_to\_length
</h2>

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

If query length is greater than a specified threshold (in bytes), then cut query when writing to query log. Also limit the length of printed query in ordinary text log.

<h2 id="log_queries_min_query_duration_ms">
  log\_queries\_min\_query\_duration\_ms
</h2>

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

If enabled (non-zero), queries faster than the value of this setting will not be logged (you can think about this as a `long_query_time` for [MySQL Slow Query Log](https://dev.mysql.com/doc/refman/5.7/slow-query-log.html)), and this basically means that you will not find them in the following tables:

* `system.query_log`
* `system.query_thread_log`

Only the queries with the following type will get to the log:

* `QUERY_FINISH`

* `EXCEPTION_WHILE_PROCESSING`

* Type: milliseconds

* Default value: 0 (any query)

<h2 id="log_queries_min_type">
  log\_queries\_min\_type
</h2>

<SettingsInfoBlock type="LogQueriesType" default_value="QUERY_START" />

`query_log` minimal type to log.

Possible values:

* `QUERY_START` (`=1`)
* `QUERY_FINISH` (`=2`)
* `EXCEPTION_BEFORE_START` (`=3`)
* `EXCEPTION_WHILE_PROCESSING` (`=4`)

Can be used to limit which entities will go to `query_log`, say you are interested only in errors, then you can use `EXCEPTION_WHILE_PROCESSING`:

```text theme={null}
log_queries_min_type='EXCEPTION_WHILE_PROCESSING'
```

<h2 id="log_queries_probability">
  log\_queries\_probability
</h2>

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

Allows a user to write to [query\_log](/reference/system-tables/query_log), [query\_thread\_log](/reference/system-tables/query_thread_log), and [query\_views\_log](/reference/system-tables/query_views_log) system tables only a sample of queries selected randomly with the specified probability. It helps to reduce the load with a large volume of queries in a second.

Possible values:

* 0 — Queries are not logged in the system tables.
* Positive floating-point number in the range \[0..1]. For example, if the setting value is `0.5`, about half of the queries are logged in the system tables.
* 1 — All queries are logged in the system tables.

<h2 id="log_query_settings">
  log\_query\_settings
</h2>

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

Log query settings into the query\_log and OpenTelemetry span log.

<h2 id="log_query_threads">
  log\_query\_threads
</h2>

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

Setting up query threads logging.

Query threads log into the [system.query\_thread\_log](/reference/system-tables/query_thread_log) table. This setting has effect only when [log\_queries](#log_queries) is true. Queries' threads run by ClickHouse with this setup are logged according to the rules in the [query\_thread\_log](/reference/settings/server-settings/settings#query_thread_log) server configuration parameter.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

**Example**

```text theme={null}
log_query_threads=1
```

<h2 id="log_query_views">
  log\_query\_views
</h2>

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

Setting up query views logging.

When a query run by ClickHouse with this setting enabled has associated views (materialized or live views), they are logged in the [query\_views\_log](/reference/settings/server-settings/settings#query_views_log) server configuration parameter.

Example:

```text theme={null}
log_query_views=1
```

<h2 id="low_cardinality_allow_in_native_format">
  low\_cardinality\_allow\_in\_native\_format
</h2>

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

Allows or restricts using the [LowCardinality](/reference/data-types/lowcardinality) data type with the [Native](/reference/formats/Native) format.

If usage of `LowCardinality` is restricted, ClickHouse server converts `LowCardinality`-columns to ordinary ones for `SELECT` queries, and convert ordinary columns to `LowCardinality`-columns for `INSERT` queries.

This setting is required mainly for third-party clients which do not support `LowCardinality` data type.

Possible values:

* 1 — Usage of `LowCardinality` is not restricted.
* 0 — Usage of `LowCardinality` is restricted.

<h2 id="low_cardinality_max_dictionary_size">
  low\_cardinality\_max\_dictionary\_size
</h2>

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

Sets a maximum size in rows of a shared global dictionary for the [LowCardinality](/reference/data-types/lowcardinality) data type that can be written to a storage file system. This setting prevents issues with RAM in case of unlimited dictionary growth. All the data that can't be encoded due to maximum dictionary size limitation ClickHouse writes in an ordinary method.

Possible values:

* Any positive integer.

<h2 id="low_cardinality_use_single_dictionary_for_part">
  low\_cardinality\_use\_single\_dictionary\_for\_part
</h2>

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

Turns on or turns off using of single dictionary for the data part.

By default, the ClickHouse server monitors the size of dictionaries and if a dictionary overflows then the server starts to write the next one. To prohibit creating several dictionaries set `low_cardinality_use_single_dictionary_for_part = 1`.

Possible values:

* 1 — Creating several dictionaries for the data part is prohibited.
* 0 — Creating several dictionaries for the data part is not prohibited.

<h2 id="low_priority_query_wait_time_ms">
  low\_priority\_query\_wait\_time\_ms
</h2>

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

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

When the query prioritization mechanism is employed (see setting `priority`), low-priority queries wait for higher-priority queries to finish. This setting specifies the duration of waiting.

<h2 id="make_distributed_plan">
  make\_distributed\_plan
</h2>

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

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

Make distributed query plan.

<h2 id="materialize_skip_indexes_on_insert">
  materialize\_skip\_indexes\_on\_insert
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "1"},{"label": "Added new setting to allow to disable materialization of skip indexes on insert"}]}]} />

If INSERTs build and store skip indexes. If disabled, skip indexes will only be built and stored [during merges](/reference/settings/merge-tree-settings#materialize_skip_indexes_on_merge) or by explicit [MATERIALIZE INDEX](/reference/statements/alter/skipping-index#materialize-index).

See also [exclude\_materialize\_skip\_indexes\_on\_insert](#exclude_materialize_skip_indexes_on_insert).

<h2 id="materialize_statistics_on_insert">
  materialize\_statistics\_on\_insert
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "Disable building statistics on INSERT by default, rely on merges instead"}]}, {"id": "row-2","items": [{"label": "24.6"},{"label": "1"},{"label": "Added new setting to allow to disable materialization of statistics on insert"}]}]} />

If INSERTs build and insert statistics. If disabled, statistics will be build and stored during merges or by explicit MATERIALIZE STATISTICS

<h2 id="materialize_ttl_after_modify">
  materialize\_ttl\_after\_modify
</h2>

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

Apply TTL for old data, after ALTER MODIFY TTL query

<h2 id="materialized_views_ignore_errors">
  materialized\_views\_ignore\_errors
</h2>

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

If enabled, exceptions thrown while pushing data to a dependent materialized view (in its `SELECT` or in the inner table sink) are logged as a warning and the `INSERT` statement succeeds. If disabled (default), such an exception propagates and the `INSERT` statement fails.

This setting controls only error reporting. It does not roll back a write to the source table, and it does not guarantee whether the original block has already been committed to the source table when an error occurs in a dependent view's pipeline. When disabled (default), the `INSERT` fails on a view error — retry it with insert deduplication (`insert_deduplicate`, `deduplicate_blocks_in_dependent_materialized_views`) for exactly-once delivery to the source table and all dependent views. When enabled, the `INSERT` reports success despite partial delivery to failing views and their downstream chains; use this only when source-table writes must not be blocked by view-side problems (for example, `system.*_log` tables). See the `CREATE VIEW` docs for full semantics.

<h2 id="materialized_views_squash_parallel_inserts">
  materialized\_views\_squash\_parallel\_inserts
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "1"},{"label": "Added setting to preserve old behavior if needed."}]}]} />

Squash inserts to materialized views destination table of a single INSERT query from parallel inserts to reduce amount of generated parts.
If set to false and `parallel_view_processing` is enabled, INSERT query will generate part in the destination table for each `max_insert_thread`.

<h2 id="max_analyze_depth">
  max\_analyze\_depth
</h2>

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

Maximum number of analyses performed by interpreter.

<h2 id="max_ast_depth">
  max\_ast\_depth
</h2>

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

The maximum nesting depth of a query syntactic tree. If exceeded, an exception is thrown.

<Note>
  At this time, it isn't checked during parsing, but only after parsing the query.
  This means that a syntactic tree that is too deep can be created during parsing,
  but the query will fail.
</Note>

<h2 id="max_ast_elements">
  max\_ast\_elements
</h2>

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

The maximum number of elements in a query syntactic tree. If exceeded, an exception is thrown.

<Note>
  At this time, it isn't checked during parsing, but only after parsing the query.
  This means that a syntactic tree that is too deep can be created during parsing,
  but the query will fail.
</Note>

<h2 id="max_autoincrement_series">
  max\_autoincrement\_series
</h2>

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

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

The limit on the number of series created by the `generateSerialID` function.

As each series represents a node in Keeper, it is recommended to have no more than a couple of millions of them.

<h2 id="max_backup_bandwidth">
  max\_backup\_bandwidth
</h2>

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

The maximum read speed in bytes per second for particular backup on server. Zero means unlimited.

<h2 id="max_block_size">
  max\_block\_size
</h2>

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

In ClickHouse, data is processed by blocks, which are sets of column parts. The internal processing cycles for a single block are efficient but there are noticeable costs when processing each block.

The `max_block_size` setting indicates the recommended maximum number of rows to include in a single block when loading data from tables. Blocks the size of `max_block_size` are not always loaded from the table: if ClickHouse determines that less data needs to be retrieved, a smaller block is processed.

The block size should not be too small to avoid noticeable costs when processing each block. It should also not be too large to ensure that queries with a LIMIT clause execute quickly after processing the first block. When setting `max_block_size`, the goal should be to avoid consuming too much memory when extracting a large number of columns in multiple threads and to preserve at least some cache locality.

<h2 id="max_bytes_before_external_group_by">
  max\_bytes\_before\_external\_group\_by
</h2>

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

Cloud default value: half the memory amount per replica.

Enables or disables execution of `GROUP BY` clauses in external memory.
(See [GROUP BY in external memory](/reference/statements/select/group-by#group-by-in-external-memory))

Possible values:

* Maximum volume of RAM (in bytes) that can be used by the single [GROUP BY](/reference/statements/select/group-by) operation.
* `0` — `GROUP BY` in external memory disabled.

<Note>
  If memory usage during GROUP BY operations is exceeding this threshold in bytes,
  activate the 'external aggregation' mode (spill data to disk).

  The recommended value is half of the available system memory.
</Note>

<h2 id="max_bytes_before_external_join">
  max\_bytes\_before\_external\_join
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "New setting to control automatic spilling of hash joins to disk. Non-zero value enables spilling and sets the byte threshold."}]}]} />

If set to a non-zero value and `join_algorithm` is `hash`, `parallel_hash`, `default`, or `auto`, the hash join will automatically be converted to grace hash join to enable spilling to disk when the right-side data exceeds this many bytes. When set to 0 (default), this absolute byte threshold is disabled, but automatic spilling may still occur via `max_bytes_ratio_before_external_join` (which defaults to `0.5`); set both to `0` to fully disable automatic spilling. It prevents read in order through join optimization.

<h2 id="max_bytes_before_external_sort">
  max\_bytes\_before\_external\_sort
</h2>

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

Cloud default value: half the memory amount per replica.

Enables or disables execution of `ORDER BY` clauses in external memory. See [ORDER BY Implementation Details](/reference/statements/select/order-by#implementation-details)
If memory usage during ORDER BY operation exceeds this threshold in bytes, the 'external sorting' mode (spill data to disk) is activated.

Possible values:

* Maximum volume of RAM (in bytes) that can be used by the single [ORDER BY](/reference/statements/select/order-by) operation.
  The recommended value is half of available system memory
* `0` — `ORDER BY` in external memory disabled.

<h2 id="max_bytes_before_remerge_sort">
  max\_bytes\_before\_remerge\_sort
</h2>

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

In case of ORDER BY with LIMIT, when memory usage is higher than specified threshold, perform additional steps of merging blocks before final merge to keep just top LIMIT rows.

<h2 id="max_bytes_for_lazy_final">
  max\_bytes\_for\_lazy\_final
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "256000000"},{"label": "New setting for maximum number of bytes in the set for lazy FINAL optimization"}]}]} />

Maximum number of bytes in the set for lazy FINAL optimization. If exceeded, falls back to normal FINAL.

<h2 id="max_bytes_in_distinct">
  max\_bytes\_in\_distinct
</h2>

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

The maximum number of bytes of the state (in uncompressed bytes) in memory, which
is used by a hash table when using DISTINCT.

<h2 id="max_bytes_in_join">
  max\_bytes\_in\_join
</h2>

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

The maximum size in bytes of the right-side data structure (typically a hash
table) used when joining tables.

This setting applies to [SELECT ... JOIN](/reference/statements/select/join)
operations and the [Join table engine](/reference/engines/table-engines/special/join).

If a query contains multiple joins, ClickHouse checks this setting for every
intermediate result. When the limit is reached, the action depends on the
chosen [`join_algorithm`](/reference/settings/session-settings#join_algorithm) — see
that setting for the per-algorithm behavior (spill, re-partition, switch, or
throw/break per [`join_overflow_mode`](/reference/settings/session-settings#join_overflow_mode)).

Possible values:

* Positive integer.
* 0 — Memory control is disabled.

<h2 id="max_bytes_in_set">
  max\_bytes\_in\_set
</h2>

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

The maximum number of bytes (of uncompressed data) used by a set in the IN clause
created from a subquery.

<h2 id="max_bytes_ratio_before_external_group_by">
  max\_bytes\_ratio\_before\_external\_group\_by
</h2>

<SettingsInfoBlock type="Double" default_value="0.5" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "0.5"},{"label": "Enable automatic spilling to disk by default."}]}, {"id": "row-2","items": [{"label": "24.12"},{"label": "0"},{"label": "New setting."}]}]} />

The ratio of available memory that is allowed for `GROUP BY`. Once reached,
external memory is used for aggregation.

For example, if set to `0.6`, `GROUP BY` will allow using 60% of the available memory
(to server/user/merges) at the beginning of the execution, after that, it will
start using external aggregation.

<h2 id="max_bytes_ratio_before_external_join">
  max\_bytes\_ratio\_before\_external\_join
</h2>

<SettingsInfoBlock type="Double" default_value="0.5" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0.5"},{"label": "New setting: ratio of available memory used as the spill threshold for hash joins. Enabled by default at `0.5`, mirroring `max_bytes_ratio_before_external_group_by` and `max_bytes_ratio_before_external_sort`. Combined with the absolute `max_bytes_before_external_join` (the smaller of the two applies)."}]}]} />

The ratio of available memory that is allowed for `JOIN`. Once reached, the hash join will be converted to grace hash join to spill the right-side data to disk.

For example, if set to `0.6`, `JOIN` will allow using `60%` of the available memory (to server/user/merges) for the right-side hash table at the beginning of the execution; after that, it starts spilling to disk.

If both `max_bytes_before_external_join` and `max_bytes_ratio_before_external_join` are set, the smaller resulting threshold is used. If the ratio is `0`, only the absolute setting applies.

Has effect only when `join_algorithm` is `hash`, `parallel_hash`, `default`, or `auto` and a temporary data path is configured.

<h2 id="max_bytes_ratio_before_external_sort">
  max\_bytes\_ratio\_before\_external\_sort
</h2>

<SettingsInfoBlock type="Double" default_value="0.5" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "0.5"},{"label": "Enable automatic spilling to disk by default."}]}, {"id": "row-2","items": [{"label": "24.12"},{"label": "0"},{"label": "New setting."}]}]} />

The ratio of available memory that is allowed for `ORDER BY`. Once reached, external sort is used.

For example, if set to `0.6`, `ORDER BY` will allow using `60%` of available memory (to server/user/merges) at the beginning of the execution, after that, it will start using external sort.

Note, that `max_bytes_before_external_sort` is still respected, spilling to disk will be done only if the sorting block is bigger then `max_bytes_before_external_sort`.

<h2 id="max_bytes_to_read">
  max\_bytes\_to\_read
</h2>

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

The maximum number of bytes (of uncompressed data) that can be read from a table when running a query.
The restriction is checked for each processed chunk of data, applied only to the
deepest table expression and when reading from a remote server, checked only on
the remote server.

<h2 id="max_bytes_to_read_leaf">
  max\_bytes\_to\_read\_leaf
</h2>

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

The maximum number of bytes (of uncompressed data) that can be read from a local
table on a leaf node when running a distributed query. While distributed queries
can issue a multiple sub-queries to each shard (leaf) - this limit will
be checked only on the read stage on the leaf nodes and will be ignored on the
merging of results stage on the root node.

For example, a cluster consists of 2 shards and each shard contains a table with
100 bytes of data. A distributed query which is supposed to read all the data
from both tables with setting `max_bytes_to_read=150` will fail as in total it
will be 200 bytes. A query with `max_bytes_to_read_leaf=150` will succeed since
leaf nodes will read 100 bytes at max.

The restriction is checked for each processed chunk of data.

<Note>
  This setting is unstable with `prefer_localhost_replica=1`.
</Note>

<h2 id="max_bytes_to_sort">
  max\_bytes\_to\_sort
</h2>

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

The maximum number of bytes before sorting. If more than the specified amount of
uncompressed bytes have to be processed for ORDER BY operation, the behavior will
be determined by the `sort_overflow_mode` which by default is set to `throw`.

<h2 id="max_bytes_to_transfer">
  max\_bytes\_to\_transfer
</h2>

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

The maximum number of bytes (uncompressed data) that can be passed to a remote
server or saved in a temporary table when the GLOBAL IN/JOIN section is executed.

<h2 id="max_columns_to_read">
  max\_columns\_to\_read
</h2>

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

The maximum number of columns that can be read from a table in a single query.
If a query requires reading more than the specified number of columns, an exception
is thrown.

<Tip>
  This setting is useful for preventing overly complex queries.
</Tip>

`0` value means unlimited.

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

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

The maximum size of blocks of uncompressed data before compressing for writing to a table. By default, 1,048,576 (1 MiB). Specifying a smaller block size generally leads to slightly reduced compression ratio, the compression and decompression speed increases slightly due to cache locality, and memory consumption is reduced.

<Note>
  This is an expert-level setting, and you shouldn't change it if you're just getting started with ClickHouse.
</Note>

Don't confuse blocks for compression (a chunk of memory consisting of bytes) with blocks for query processing (a set of rows from a table).

<h2 id="max_concurrent_queries_for_all_users">
  max\_concurrent\_queries\_for\_all\_users
</h2>

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

Throw exception if the value of this setting is less or equal than the current number of simultaneously processed queries.

Example: `max_concurrent_queries_for_all_users` can be set to 99 for all users and database administrator can set it to 100 for itself to run queries for investigation even when the server is overloaded.

Modifying the setting for one query or user does not affect other queries.

Possible values:

* Positive integer.
* 0 — No limit.

**Example**

```xml theme={null}
<max_concurrent_queries_for_all_users>99</max_concurrent_queries_for_all_users>
```

**See Also**

* [max\_concurrent\_queries](/reference/settings/server-settings/settings#max_concurrent_queries)

Cloud default value: `1000`.

<h2 id="max_concurrent_queries_for_user">
  max\_concurrent\_queries\_for\_user
</h2>

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

The maximum number of simultaneously processed queries per user.

Possible values:

* Positive integer.
* 0 — No limit.

**Example**

```xml theme={null}
<max_concurrent_queries_for_user>5</max_concurrent_queries_for_user>
```

<h2 id="max_consume_snapshots">
  max\_consume\_snapshots
</h2>

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

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

Maximum number of Paimon snapshots to consume per incremental read. 0 means no limit.

<h2 id="max_distributed_connections">
  max\_distributed\_connections
</h2>

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

The maximum number of simultaneous connections with remote servers for distributed processing of a single query to a single Distributed table. We recommend setting a value no less than the number of servers in the cluster.

The following parameters are only used when creating Distributed tables (and when launching a server), so there is no reason to change them at runtime.

<h2 id="max_distributed_depth">
  max\_distributed\_depth
</h2>

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

Limits the maximum depth of recursive queries for [Distributed](/reference/engines/table-engines/special/distributed) tables.

If the value is exceeded, the server throws an exception.

Possible values:

* Positive integer.
* 0 — Unlimited depth.

<h2 id="max_download_buffer_size">
  max\_download\_buffer\_size
</h2>

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

The maximal size of buffer for parallel downloading (e.g. for URL engine) per each thread.

<h2 id="max_download_threads">
  max\_download\_threads
</h2>

<SettingsInfoBlock type="MaxThreads" default_value="4" />

The maximum number of threads to download data (e.g. for URL engine).

<h2 id="max_estimated_execution_time">
  max\_estimated\_execution\_time
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "0"},{"label": "Separate max_execution_time and max_estimated_execution_time"}]}]} />

Maximum query estimate execution time in seconds. Checked on every data block
when [`timeout_before_checking_execution_speed`](/reference/settings/session-settings#timeout_before_checking_execution_speed)
expires.

<h2 id="max_execution_speed">
  max\_execution\_speed
</h2>

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

The maximum number of execution rows per second. Checked on every data block when
[`timeout_before_checking_execution_speed`](/reference/settings/session-settings#timeout_before_checking_execution_speed)
expires. If the execution speed is high, the execution speed will be reduced.

<h2 id="max_execution_speed_bytes">
  max\_execution\_speed\_bytes
</h2>

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

The maximum number of execution bytes per second. Checked on every data block when
[`timeout_before_checking_execution_speed`](/reference/settings/session-settings#timeout_before_checking_execution_speed)
expires. If the execution speed is high, the execution speed will be reduced.

<h2 id="max_execution_time">
  max\_execution\_time
</h2>

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

The maximum query execution time in seconds.

The `max_execution_time` parameter can be a bit tricky to understand.
It operates based on interpolation relative to the current query execution speed
(this behaviour is controlled by [`timeout_before_checking_execution_speed`](/reference/settings/session-settings#timeout_before_checking_execution_speed)).

ClickHouse will interrupt a query if the projected execution time exceeds the
specified `max_execution_time`. By default, the `timeout_before_checking_execution_speed`
is set to 10 seconds. This means that after 10 seconds of query execution, ClickHouse
will begin estimating the total execution time. If, for example, `max_execution_time`
is set to 3600 seconds (1 hour), ClickHouse will terminate the query if the estimated
time exceeds this 3600-second limit. If you set `timeout_before_checking_execution_speed`
to 0, ClickHouse will use the clock time as the basis for `max_execution_time`.

If query runtime exceeds the specified number of seconds, the behavior will be
determined by the 'timeout\_overflow\_mode', which by default is set to `throw`.

<Note>
  The timeout is checked and the query can stop only in designated places during data processing.
  It currently cannot stop during merging of aggregation states or during query analysis,
  and the actual run time will be higher than the value of this setting.
</Note>

<h2 id="max_execution_time_leaf">
  max\_execution\_time\_leaf
</h2>

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

Similar semantically to [`max_execution_time`](#max_execution_time) but only
applied on leaf nodes for distributed or remote queries.

For example, if we want to limit the execution time on a leaf node to `10s` but
have no limit on the initial node, instead of having `max_execution_time` in the
nested subquery settings:

```sql theme={null}
SELECT count()
FROM cluster(cluster, view(SELECT * FROM t SETTINGS max_execution_time = 10));
```

We can use `max_execution_time_leaf` as the query settings:

```sql theme={null}
SELECT count()
FROM cluster(cluster, view(SELECT * FROM t)) SETTINGS max_execution_time_leaf = 10;
```

<h2 id="max_expanded_ast_elements">
  max\_expanded\_ast\_elements
</h2>

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

Maximum size of query syntax tree in number of nodes after expansion of aliases and the asterisk.

<h2 id="max_fetch_partition_retries_count">
  max\_fetch\_partition\_retries\_count
</h2>

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

Amount of retries while fetching partition from another host.

<h2 id="max_final_threads">
  max\_final\_threads
</h2>

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

Sets the maximum number of parallel threads for the `SELECT` query data read phase with the [FINAL](/reference/statements/select/from#final-modifier) modifier.

Possible values:

* Positive integer.
* 0 or 1 — Disabled. `SELECT` queries are executed in a single thread.

<h2 id="max_http_get_redirects">
  max\_http\_get\_redirects
</h2>

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

Max number of HTTP GET redirects hops allowed. Ensures additional security measures are in place to prevent a malicious server from redirecting your requests to unexpected services.\n\nIt is the case when an external server redirects to another address, but that address appears to be internal to the company's infrastructure, and by sending an HTTP request to an internal server, you could request an internal API from the internal network, bypassing the auth, or even query other services, such as Redis or Memcached. When you don't have an internal infrastructure (including something running on your localhost), or you trust the server, it is safe to allow redirects. Although keep in mind, that if the URL uses HTTP instead of HTTPS, and you will have to trust not only the remote server but also your ISP and every network in the middle.

Cloud default value: `10`.

<h2 id="max_hyperscan_regexp_length">
  max\_hyperscan\_regexp\_length
</h2>

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

Defines the maximum length for each regular expression in the [hyperscan multi-match functions](/reference/functions/regular-functions/string-search-functions#multiMatchAny).

Possible values:

* Positive integer.
* 0 - The length is not limited.

**Example**

Query:

```sql theme={null}
SELECT multiMatchAny('abcd', ['ab','bcd','c','d']) SETTINGS max_hyperscan_regexp_length = 3;
```

Result:

```text theme={null}
┌─multiMatchAny('abcd', ['ab', 'bcd', 'c', 'd'])─┐
│                                              1 │
└────────────────────────────────────────────────┘
```

Query:

```sql theme={null}
SELECT multiMatchAny('abcd', ['ab','bcd','c','d']) SETTINGS max_hyperscan_regexp_length = 2;
```

Result:

```text theme={null}
Exception: Regexp length too large.
```

**See Also**

* [max\_hyperscan\_regexp\_total\_length](#max_hyperscan_regexp_total_length)

<h2 id="max_hyperscan_regexp_total_length">
  max\_hyperscan\_regexp\_total\_length
</h2>

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

Sets the maximum length total of all regular expressions in each [hyperscan multi-match function](/reference/functions/regular-functions/string-search-functions#multiMatchAny).

Possible values:

* Positive integer.
* 0 - The length is not limited.

**Example**

Query:

```sql theme={null}
SELECT multiMatchAny('abcd', ['a','b','c','d']) SETTINGS max_hyperscan_regexp_total_length = 5;
```

Result:

```text theme={null}
┌─multiMatchAny('abcd', ['a', 'b', 'c', 'd'])─┐
│                                           1 │
└─────────────────────────────────────────────┘
```

Query:

```sql theme={null}
SELECT multiMatchAny('abcd', ['ab','bc','c','d']) SETTINGS max_hyperscan_regexp_total_length = 5;
```

Result:

```text theme={null}
Exception: Total regexp lengths too large.
```

**See Also**

* [max\_hyperscan\_regexp\_length](#max_hyperscan_regexp_length)

<h2 id="max_insert_block_size">
  max\_insert\_block\_size
</h2>

**Aliases**: `max_insert_block_size_rows`

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

The maximum size of blocks (in a count of rows) to form for insertion into a table.

This setting controls block formation in two contexts:

1. Format parsing: When the server parses row-based input formats (CSV, TSV, JSONEachRow, etc.) from any interface (HTTP, clickhouse-client with inline data, gRPC, PostgreSQL wire protocol), blocks are emitted when:

   * Both min\_insert\_block\_size\_rows AND min\_insert\_block\_size\_bytes are reached, OR
   * Either max\_insert\_block\_size\_rows OR max\_insert\_block\_size\_bytes is reached

   Note: When using clickhouse-client or clickhouse-local to read from a file, the client itself parses the data and this setting applies on the client side.

2. INSERT operations: During INSERT queries and when data flows through materialized views, this setting's behavior depends on `use_strict_insert_block_limits`:

   * When enabled: Blocks are emitted when:
     * Min thresholds (AND): Both min\_insert\_block\_size\_rows AND min\_insert\_block\_size\_bytes are reached
     * Max thresholds (OR): Either max\_insert\_block\_size\_rows OR max\_insert\_block\_size\_bytes is reached

   * When disabled: Blocks are emitted when min\_insert\_block\_size\_rows OR min\_insert\_block\_size\_bytes is reached. The max\_insert\_block\_size settings are not enforced.

Possible values:

* Positive integer.

<h2 id="max_insert_block_size_bytes">
  max\_insert\_block\_size\_bytes
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "0"},{"label": "New setting that allows to control the size of blocks in bytes during parsing of data in Row Input Format."}]}]} />

The maximum size of blocks (in bytes) to form for insertion into a table.

This setting works together with max\_insert\_block\_size\_rows and controls block formation in the same context. See max\_insert\_block\_size\_rows for detailed information about when and how these settings are applied.

Possible values:

* Positive integer.
* 0 — setting does not participate in block formation.

<h2 id="max_insert_delayed_streams_for_parallel_write">
  max\_insert\_delayed\_streams\_for\_parallel\_write
</h2>

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

The maximum number of streams (columns) to delay final part flush. Default - auto (100 in case of underlying storage supports parallel write, for example S3 and disabled otherwise)

Cloud default value: `50`.

<h2 id="max_insert_threads">
  max\_insert\_threads
</h2>

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

The maximum number of threads to execute the `INSERT SELECT` query.

Possible values:

* 0 (or 1) — `INSERT SELECT` no parallel execution.
* Positive integer. Bigger than 1.

Cloud default value:

* `1` for nodes with 8 GiB memory
* `2` for nodes with 16 GiB memory
* `4` for larger nodes

Parallel `INSERT SELECT` has effect only if the `SELECT` part is executed in parallel, see [`max_threads`](#max_threads) setting.
Higher values will lead to higher memory usage.

<h2 id="max_insert_threads_min_free_memory_per_thread">
  max\_insert\_threads\_min\_free\_memory\_per\_thread
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "4294967296"},{"label": "New setting to limit the number of insert threads based on available free memory"}]}]} />

Same as `max_threads_min_free_memory_per_thread`, but applied to `max_insert_threads` instead of `max_threads`. The default is higher because insert pipelines typically hold larger per-thread buffers (merge tree parts, compression blocks) than read pipelines.

If the amount of free memory is less than `max_insert_threads` multiplied by this value, `max_insert_threads` is reduced to fit, down to a minimum of `1`.

Set to `0` to disable this limit.

<h2 id="max_joined_block_size_bytes">
  max\_joined\_block\_size\_bytes
</h2>

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

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

Maximum block size in bytes for JOIN result (if join algorithm supports it). 0 means unlimited.

<h2 id="max_joined_block_size_rows">
  max\_joined\_block\_size\_rows
</h2>

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

Maximum block size for JOIN result (if join algorithm supports it). 0 means unlimited.

<h2 id="max_limit_for_vector_search_queries">
  max\_limit\_for\_vector\_search\_queries
</h2>

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

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

SELECT queries with LIMIT bigger than this setting cannot use vector similarity indices. Helps to prevent memory overflows in vector similarity indices.

<h2 id="max_local_read_bandwidth">
  max\_local\_read\_bandwidth
</h2>

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

The maximum speed of local reads in bytes per second.

<h2 id="max_local_write_bandwidth">
  max\_local\_write\_bandwidth
</h2>

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

The maximum speed of local writes in bytes per second.

<h2 id="max_memory_usage">
  max\_memory\_usage
</h2>

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

Cloud default value: depends on the amount of RAM on the replica.

The maximum amount of RAM to use for running a query on a single server.
A value of `0` means unlimited.

This setting does not consider the volume of available memory or the total volume
of memory on the machine. The restriction applies to a single query within a
single server.

You can use `SHOW PROCESSLIST` to see the current memory consumption for each query.
Peak memory consumption is tracked for each query and written to the log.

Memory usage is not fully tracked for states of the following aggregate functions
from `String` and `Array` arguments:

* `min`
* `max`
* `any`
* `anyLast`
* `argMin`
* `argMax`

Memory consumption is also restricted by the parameters [`max_memory_usage_for_user`](/reference/settings/session-settings#max_memory_usage_for_user)
and [`max_server_memory_usage`](/reference/settings/server-settings/settings#max_server_memory_usage).

<h2 id="max_memory_usage_for_user">
  max\_memory\_usage\_for\_user
</h2>

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

The maximum amount of RAM to use for running a user's queries on a single server. Zero means unlimited.

By default, the amount is not restricted (`max_memory_usage_for_user = 0`).

Also see the description of [`max_memory_usage`](/reference/settings/session-settings#max_memory_usage).

For example if you want to set `max_memory_usage_for_user` to 1000 bytes for a user named `clickhouse_read`, you can use the statement

```sql theme={null}
ALTER USER clickhouse_read SETTINGS max_memory_usage_for_user = 1000;
```

You can verify it worked by logging out of your client, logging back in, then use the `getSetting` function:

```sql theme={null}
SELECT getSetting('max_memory_usage_for_user');
```

<h2 id="max_network_bandwidth">
  max\_network\_bandwidth
</h2>

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

Limits the speed of the data exchange over the network in bytes per second. This setting applies to every query.

Possible values:

* Positive integer.
* 0 — Bandwidth control is disabled.

<h2 id="max_network_bandwidth_for_all_users">
  max\_network\_bandwidth\_for\_all\_users
</h2>

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

Limits the speed that data is exchanged at over the network in bytes per second. This setting applies to all concurrently running queries on the server.

Possible values:

* Positive integer.
* 0 — Control of the data speed is disabled.

<h2 id="max_network_bandwidth_for_user">
  max\_network\_bandwidth\_for\_user
</h2>

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

Limits the speed of the data exchange over the network in bytes per second. This setting applies to all concurrently running queries performed by a single user.

Possible values:

* Positive integer.
* 0 — Control of the data speed is disabled.

<h2 id="max_network_bytes">
  max\_network\_bytes
</h2>

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

Limits the data volume (in bytes) that is received or transmitted over the network when executing a query. This setting applies to every individual query.

Possible values:

* Positive integer.
* 0 — Data volume control is disabled.

<h2 id="max_number_of_partitions_for_independent_aggregation">
  max\_number\_of\_partitions\_for\_independent\_aggregation
</h2>

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

Maximal number of partitions in table to apply optimizatio

<h2 id="max_os_cpu_wait_time_ratio_to_throw">
  max\_os\_cpu\_wait\_time\_ratio\_to\_throw
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "0"},{"label": "Setting values were changed and backported to 25.4"}]}, {"id": "row-2","items": [{"label": "25.4"},{"label": "0"},{"label": "New setting"}]}]} />

Max ratio between OS CPU wait (OSCPUWaitMicroseconds metric) and busy (OSCPUVirtualTimeMicroseconds metric) times to consider rejecting queries. Linear interpolation between min and max ratio is used to calculate the probability, the probability is 1 at this point.

<h2 id="max_parallel_replicas">
  max\_parallel\_replicas
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1000"},{"label": "Use up to 1000 parallel replicas by default."}]}]} />

The maximum number of replicas for each shard when executing a query.

Possible values:

* Positive integer.

**Additional Info**

This options will produce different results depending on the settings used.

### Parallel processing using `SAMPLE` key

A query may be processed faster if it is executed on several servers in parallel. But the query performance may degrade in the following cases:

* The position of the sampling key in the partitioning key does not allow efficient range scans.
* Adding a sampling key to the table makes filtering by other columns less efficient.
* The sampling key is an expression that is expensive to calculate.
* The cluster latency distribution has a long tail, so that querying more servers increases the query overall latency.

### Parallel processing using [parallel\_replicas\_custom\_key](#parallel_replicas_custom_key)

This setting is useful for any replicated table.

<h2 id="max_parser_backtracks">
  max\_parser\_backtracks
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1000000"},{"label": "Limiting the complexity of parsing"}]}]} />

Maximum parser backtracking (how many times it tries different alternatives in the recursive descend parsing process).

<h2 id="max_parser_depth">
  max\_parser\_depth
</h2>

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

Limits maximum recursion depth in the recursive descent parser. Allows controlling the stack size.

Possible values:

* Positive integer.
* 0 — Recursion depth is unlimited.

<h2 id="max_parsing_threads">
  max\_parsing\_threads
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "0"},{"label": "Add a separate setting to control number of threads in parallel parsing from files"}]}]} />

The maximum number of threads to parse data in input formats that support parallel parsing. By default, it is determined automatically.

<h2 id="max_partition_size_to_drop">
  max\_partition\_size\_to\_drop
</h2>

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

Restriction on dropping partitions in query time. The value `0` means that you can drop partitions without any restrictions.

Cloud default value: 1 TB.

<Note>
  This query setting overwrites its server setting equivalent, see [max\_partition\_size\_to\_drop](/reference/settings/server-settings/settings#max_partition_size_to_drop)
</Note>

<h2 id="max_partitions_per_insert_block">
  max\_partitions\_per\_insert\_block
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "19.5"},{"label": "100"},{"label": "Add a limit for the number of partitions in one block"}]}]} />

Limits the maximum number of partitions in a single inserted block
and an exception is thrown if the block contains too many partitions.

* Positive integer.
* `0` — Unlimited number of partitions.

**Details**

When inserting data, ClickHouse calculates the number of partitions in the
inserted block. If the number of partitions is more than
`max_partitions_per_insert_block`, ClickHouse either logs a warning or throws an
exception based on `throw_on_max_partitions_per_insert_block`. Exceptions have
the following text:

> "Too many partitions for a single INSERT block (`partitions_count` partitions, limit is " + toString(max\_partitions) + ").
> The limit is controlled by the 'max\_partitions\_per\_insert\_block' setting.
> A large number of partitions is a common misconception. It will lead to severe
> negative performance impact, including slow server startup, slow INSERT queries
> and slow SELECT queries. Recommended total number of partitions for a table is
> under 1000..10000. Please note, that partitioning is not intended to speed up
> SELECT queries (ORDER BY key is sufficient to make range queries fast).
> Partitions are intended for data manipulation (DROP PARTITION, etc)."

<Note>
  This setting is a safety threshold because using a large number of partitions is a common misconception.
</Note>

<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 a single query.

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

Possible values:

* Positive integer
* `-1` - unlimited (default)

<Note>
  You can also specify the MergeTree setting [`max_partitions_to_read`](/reference/settings/session-settings#max_partitions_to_read) in tables' setting.
</Note>

<h2 id="max_parts_to_move">
  max\_parts\_to\_move
</h2>

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

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

Limit the number of parts that can be moved in one query. Zero means unlimited.

<h2 id="max_projection_rows_to_use_projection_index">
  max\_projection\_rows\_to\_use\_projection\_index
</h2>

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

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

If the number of rows to read from the projection index is less than or equal to this threshold, ClickHouse will try to apply the projection index during query execution.

<h2 id="max_query_size">
  max\_query\_size
</h2>

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

The maximum number of bytes of a query string parsed by the SQL parser.
Data in the VALUES clause of INSERT queries is processed by a separate stream parser (that consumes O(1) RAM) and not affected by this restriction.

<Note>
  `max_query_size` cannot be set within an SQL query (e.g., `SELECT now() SETTINGS max_query_size=10000`) because ClickHouse needs to allocate a buffer to parse the query, and this buffer size is determined by the `max_query_size` setting, which must be configured before the query is executed.
</Note>

<h2 id="max_rand_distribution_parameter">
  max\_rand\_distribution\_parameter
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1000000"},{"label": "New setting to limit shape parameters in random distribution functions, preventing hangs with extreme inputs."}]}]} />

Maximum value for distribution shape parameters in random distribution functions such as `randChiSquared`, `randStudentT`, and `randFisherF`. This prevents extremely long computation times with extreme parameter values.

<h2 id="max_rand_distribution_trials">
  max\_rand\_distribution\_trials
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1000000000"},{"label": "New setting to limit trial counts in random distribution functions, preventing hangs with extreme inputs."}]}]} />

Maximum number of trials allowed for random distribution functions such as `randBinomial` and `randNegativeBinomial`. This prevents extremely long computation times with large trial counts.

<h2 id="max_read_buffer_size">
  max\_read\_buffer\_size
</h2>

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

The maximum size of the buffer to read from the filesystem.

<h2 id="max_read_buffer_size_local_fs">
  max\_read\_buffer\_size\_local\_fs
</h2>

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

The maximum size of the buffer to read from local filesystem. If set to 0 then max\_read\_buffer\_size will be used.

<h2 id="max_read_buffer_size_remote_fs">
  max\_read\_buffer\_size\_remote\_fs
</h2>

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

The maximum size of the buffer to read from remote filesystem. If set to 0 then max\_read\_buffer\_size will be used.

<h2 id="max_recursive_cte_evaluation_depth">
  max\_recursive\_cte\_evaluation\_depth
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "1000"},{"label": "Maximum limit on recursive CTE evaluation depth"}]}]} />

Maximum limit on recursive CTE evaluation depth

<h2 id="max_remote_read_network_bandwidth">
  max\_remote\_read\_network\_bandwidth
</h2>

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

The maximum speed of data exchange over the network in bytes per second for read.

<h2 id="max_remote_write_network_bandwidth">
  max\_remote\_write\_network\_bandwidth
</h2>

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

The maximum speed of data exchange over the network in bytes per second for write.

<h2 id="max_replica_delay_for_distributed_queries">
  max\_replica\_delay\_for\_distributed\_queries
</h2>

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

Disables lagging replicas for distributed queries. See [Replication](/reference/engines/table-engines/mergetree-family/replication).

Sets the time in seconds. If a replica's lag is greater than or equal to the set value, this replica is not used.

Possible values:

* Positive integer.
* 0 — Replica lags are not checked.

To prevent the use of any replica with a non-zero lag, set this parameter to 1.

Used when performing `SELECT` from a distributed table that points to replicated tables.

<h2 id="max_result_bytes">
  max\_result\_bytes
</h2>

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

Limits the result size in bytes (uncompressed). The query will stop after processing a block of data if the threshold is met,
but it will not cut the last block of the result, therefore the result size can be larger than the threshold.

**Caveats**

The result size in memory is taken into account for this threshold.
Even if the result size is small, it can reference larger data structures in memory,
representing dictionaries of LowCardinality columns, and Arenas of AggregateFunction columns,
so the threshold can be exceeded despite the small result size.

<Warning>
  The setting is fairly low level and should be used with caution
</Warning>

<h2 id="max_result_rows">
  max\_result\_rows
</h2>

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

Cloud default value: `0`.

Limits the number of rows in the result. Also checked for subqueries, and on remote servers when running parts of a distributed query.
No limit is applied when the value is `0`.

The query will stop after processing a block of data if the threshold is met, but
it will not cut the last block of the result, therefore the result size can be
larger than the threshold.

<h2 id="max_reverse_dictionary_lookup_cache_size_bytes">
  max\_reverse\_dictionary\_lookup\_cache\_size\_bytes
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "104857600"},{"label": "New setting. Maximum size in bytes of the per-query reverse dictionary lookup cache used by the function `dictGetKeys`. The cache stores serialized key tuples per attribute value to avoid re-scanning the dictionary within the same query."}]}]} />

Maximum size in bytes of the per-query reverse dictionary lookup cache used by the function `dictGetKeys`. The cache stores serialized key tuples per attribute value to avoid re-scanning the dictionary within the same query. When the limit is reached, entries are evicted using LRU. Set to 0 to disable caching.

<h2 id="max_rows_for_lazy_final">
  max\_rows\_for\_lazy\_final
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "10000000"},{"label": "New setting for maximum number of rows in the set for lazy FINAL optimization"}]}]} />

Maximum number of rows in the set for lazy FINAL optimization. If exceeded, falls back to normal FINAL.

<h2 id="max_rows_in_distinct">
  max\_rows\_in\_distinct
</h2>

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

The maximum number of different rows when using DISTINCT.

<h2 id="max_rows_in_join">
  max\_rows\_in\_join
</h2>

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

Limits the number of rows in the right-side data structure (typically a hash
table) used when joining tables.

This setting applies to [SELECT ... JOIN](/reference/statements/select/join)
operations and the [Join](/reference/engines/table-engines/special/join) table engine.

If a query contains multiple joins, ClickHouse checks this setting for every
intermediate result. When the limit is reached, the action depends on the
chosen [`join_algorithm`](/reference/settings/session-settings#join_algorithm) — see
that setting for the per-algorithm behavior (spill, re-partition, switch, or
throw/break per [`join_overflow_mode`](/reference/settings/session-settings#join_overflow_mode)).

Possible values:

* Positive integer.
* `0` — Unlimited number of rows.

<h2 id="max_rows_in_set">
  max\_rows\_in\_set
</h2>

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

The maximum number of rows for a data set in the IN clause created from a subquery.

<h2 id="max_rows_in_set_to_optimize_join">
  max\_rows\_in\_set\_to\_optimize\_join
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "0"},{"label": "Disable join optimization as it prevents from read in order optimization"}]}]} />

Maximal size of the set to filter joined tables by each other's row sets before joining.

Possible values:

* 0 — Disable.
* Any positive integer.

<h2 id="max_rows_to_group_by">
  max\_rows\_to\_group\_by
</h2>

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

The maximum number of unique keys received from aggregation. This setting lets
you limit memory consumption when aggregating.

If aggregation during GROUP BY is generating more than the specified number of
rows (unique GROUP BY keys), the behavior will be determined by the
'group\_by\_overflow\_mode' which by default is `throw`, but can be also switched
to an approximate GROUP BY mode.

<h2 id="max_rows_to_read">
  max\_rows\_to\_read
</h2>

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

The maximum number of rows that can be read from a table when running a query.
The restriction is checked for each processed chunk of data, applied only to the
deepest table expression and when reading from a remote server, checked only on
the remote server.

<h2 id="max_rows_to_read_leaf">
  max\_rows\_to\_read\_leaf
</h2>

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

The maximum number of rows that can be read from a local table on a leaf node when
running a distributed query. While distributed queries can issue multiple sub-queries
to each shard (leaf) - this limit will be checked only on the read stage on the
leaf nodes and ignored on the merging of results stage on the root node.

For example, a cluster consists of 2 shards and each shard contains a table with
100 rows. The distributed query which is supposed to read all the data from both
tables with setting `max_rows_to_read=150` will fail, as in total there will be
200 rows. A query with `max_rows_to_read_leaf=150` will succeed, since leaf nodes
will read at max 100 rows.

The restriction is checked for each processed chunk of data.

<Note>
  This setting is unstable with `prefer_localhost_replica=1`.
</Note>

<h2 id="max_rows_to_sort">
  max\_rows\_to\_sort
</h2>

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

The maximum number of rows before sorting. This allows you to limit memory consumption when sorting.
If more than the specified amount of records have to be processed for the ORDER BY operation,
the behavior will be determined by the `sort_overflow_mode` which by default is set to `throw`.

<h2 id="max_rows_to_transfer">
  max\_rows\_to\_transfer
</h2>

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

Maximum size (in rows) that can be passed to a remote server or saved in a
temporary table when the GLOBAL IN/JOIN section is executed.

<h2 id="max_sessions_for_user">
  max\_sessions\_for\_user
</h2>

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

Maximum number of simultaneous sessions per authenticated user to the ClickHouse server.

Example:

```xml theme={null}
<profiles>
    <single_session_profile>
        <max_sessions_for_user>1</max_sessions_for_user>
    </single_session_profile>
    <two_sessions_profile>
        <max_sessions_for_user>2</max_sessions_for_user>
    </two_sessions_profile>
    <unlimited_sessions_profile>
        <max_sessions_for_user>0</max_sessions_for_user>
    </unlimited_sessions_profile>
</profiles>
<users>
    <!-- User Alice can connect to a ClickHouse server no more than once at a time. -->
    <Alice>
        <profile>single_session_user</profile>
    </Alice>
    <!-- User Bob can use 2 simultaneous sessions. -->
    <Bob>
        <profile>two_sessions_profile</profile>
    </Bob>
    <!-- User Charles can use arbitrarily many of simultaneous sessions. -->
    <Charles>
        <profile>unlimited_sessions_profile</profile>
    </Charles>
</users>
```

Possible values:

* Positive integer
* `0` - infinite count of simultaneous sessions (default)

<h2 id="max_size_to_preallocate_for_aggregation">
  max\_size\_to\_preallocate\_for\_aggregation
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000000000000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.12"},{"label": "1000000000000"},{"label": "Enable optimisation for bigger tables."}]}, {"id": "row-2","items": [{"label": "22.12"},{"label": "100000000"},{"label": "This optimizes performance"}]}]} />

For how many elements it is allowed to preallocate space in all hash tables in total before aggregatio

<h2 id="max_size_to_preallocate_for_joins">
  max\_size\_to\_preallocate\_for\_joins
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000000000000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "100000000"},{"label": "New setting."}]}, {"id": "row-2","items": [{"label": "24.12"},{"label": "1000000000000"},{"label": "Enable optimisation for bigger tables."}]}]} />

For how many elements it is allowed to preallocate space in all hash tables in total before joi

<h2 id="max_skip_unavailable_shards_num">
  max\_skip\_unavailable\_shards\_num
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "New setting to limit the number of shards that can be silently skipped when skip_unavailable_shards is enabled."}]}]} />

When `skip_unavailable_shards` is enabled, limits the maximum number of shards that can be silently skipped.
If the number of unavailable shards exceeds this value, an exception is thrown instead of silently skipping.

A value of 0 means no limit (default behavior — all unavailable shards can be skipped).

<h2 id="max_skip_unavailable_shards_ratio">
  max\_skip\_unavailable\_shards\_ratio
</h2>

<SettingsInfoBlock type="Float" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "New setting to limit the ratio of shards that can be silently skipped when skip_unavailable_shards is enabled."}]}]} />

When `skip_unavailable_shards` is enabled, limits the maximum ratio (0 to 1) of shards that can be silently skipped.
If the ratio of unavailable shards to total shards exceeds this value, an exception is thrown instead of silently skipping.

A value of 0 means no limit (default behavior — all unavailable shards can be skipped).

<h2 id="max_streams_for_files_processing_in_cluster_functions">
  max\_streams\_for\_files\_processing\_in\_cluster\_functions
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "0"},{"label": "Add a new setting that allows to limit number of streams for files processing in *Cluster table functions"}]}]} />

If is not zero, limit the number of threads reading data from files in \*Cluster table functions.

<h2 id="max_streams_for_merge_tree_reading">
  max\_streams\_for\_merge\_tree\_reading
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

If is not zero, limit the number of reading streams for MergeTree table.

<h2 id="max_streams_for_union_step">
  max\_streams\_for\_union\_step
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting to limit the number of simultaneously active data streams in a UNION step to reduce peak memory usage."}]}]} />

Limits the number of simultaneously active data streams in a `UNION` step (applies to both `UNION ALL` and `UNION DISTINCT`, because `UNION DISTINCT` is implemented via a `UNION ALL` step followed by a `DISTINCT` step). When a `UNION` query has many subqueries, all of them open their read buffers at the same time, leading to memory usage proportional to the number of subqueries. This setting inserts `Concat` processors to narrow the pipeline so that at most this many streams are active at once, drastically reducing peak memory. The actual limit is the minimum of this value and `max_threads * max_streams_for_union_step_to_max_threads_ratio` (either one being 0 means it is ignored). When both are 0, no narrowing is applied. The limit is also not applied when the query plan requires each output stream of the `UNION` to stay individually sorted (for example, when the read-in-order optimization is applied across the `UNION`); in that case correctness of the ordering takes precedence and narrowing is skipped.

<h2 id="max_streams_for_union_step_to_max_threads_ratio">
  max\_streams\_for\_union\_step\_to\_max\_threads\_ratio
</h2>

<SettingsInfoBlock type="Float" default_value="8" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "8"},{"label": "New setting: the limit on simultaneously active streams in a UNION step is computed as min(max_streams_for_union_step, max_threads * max_streams_for_union_step_to_max_threads_ratio), either being 0 disables that input."}]}]} />

This ratio multiplied by `max_threads` determines a limit on simultaneously active streams in a `UNION` step (applies to both `UNION ALL` and `UNION DISTINCT`). The actual limit is the minimum of this computed value and `max_streams_for_union_step` (either one being 0 means it is ignored). For example, with `max_threads = 8` and this ratio set to 1, at most 8 streams will be active. Set to 0 to disable this ratio-based limit. Like `max_streams_for_union_step`, the limit is not applied when the query plan requires each output stream of the `UNION` to stay individually sorted.

<h2 id="max_streams_multiplier_for_merge_tables">
  max\_streams\_multiplier\_for\_merge\_tables
</h2>

<SettingsInfoBlock type="Float" default_value="5" />

Ask more streams when reading from Merge table. Streams will be spread across tables that Merge table will use. This allows more even distribution of work across threads and is especially helpful when merged tables differ in size.

<h2 id="max_streams_to_max_threads_ratio">
  max\_streams\_to\_max\_threads\_ratio
</h2>

<SettingsInfoBlock type="Float" default_value="1" />

Allows you to use more sources than the number of threads - to more evenly distribute work across threads. It is assumed that this is a temporary solution since it will be possible in the future to make the number of sources equal to the number of threads, but for each source to dynamically select available work for itself.

<h2 id="max_subquery_depth">
  max\_subquery\_depth
</h2>

<SettingsInfoBlock type="UInt64" default_value="100" />

If a query has more than the specified number of nested subqueries, throws an
exception.

<Tip>
  This allows you to have a sanity check to protect against the users of your
  cluster from writing overly complex queries.
</Tip>

<h2 id="max_table_size_to_drop">
  max\_table\_size\_to\_drop
</h2>

<SettingsInfoBlock type="UInt64" default_value="50000000000" />

Restriction on deleting tables in query time. The value `0` means that you can delete all tables without any restrictions.

Cloud default value: 1 TB.

<Note>
  This query setting overwrites its server setting equivalent, see [max\_table\_size\_to\_drop](/reference/settings/server-settings/settings#max_table_size_to_drop)
</Note>

<h2 id="max_temporary_columns">
  max\_temporary\_columns
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The maximum number of temporary columns that must be kept in RAM simultaneously
when running a query, including constant columns. If a query generates more than
the specified number of temporary columns in memory as a result of intermediate
calculation, then an exception is thrown.

<Tip>
  This setting is useful for preventing overly complex queries.
</Tip>

`0` value means unlimited.

<h2 id="max_temporary_data_on_disk_size_for_query">
  max\_temporary\_data\_on\_disk\_size\_for\_query
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The maximum amount of data consumed by temporary files on disk in bytes for all
concurrently running queries.

Possible values:

* Positive integer.
* `0` — unlimited (default)

<h2 id="max_temporary_data_on_disk_size_for_user">
  max\_temporary\_data\_on\_disk\_size\_for\_user
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The maximum amount of data consumed by temporary files on disk in bytes for all
concurrently running user queries.

Possible values:

* Positive integer.
* `0` — unlimited (default)

<h2 id="max_temporary_non_const_columns">
  max\_temporary\_non\_const\_columns
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Like `max_temporary_columns`, the maximum number of temporary columns that must
be kept in RAM simultaneously when running a query, but without counting constant
columns.

<Note>
  Constant columns are formed fairly often when running a query, but they require
  approximately zero computing resources.
</Note>

<h2 id="max_threads">
  max\_threads
</h2>

<SettingsInfoBlock type="MaxThreads" default_value="'auto(N)'" />

The maximum number of query processing threads, excluding threads for retrieving data from remote servers (see the ['max\_distributed\_connections'](/reference/settings/session-settings#max_distributed_connections) parameter).

This parameter applies to threads that perform the same stages of the query processing pipeline in parallel.
For example, when reading from a table, if it is possible to evaluate expressions with functions, filter with `WHERE` and pre-aggregate for `GROUP BY` in parallel using at least 'max\_threads' number of threads, then 'max\_threads' are used.

For queries that are completed quickly because of a LIMIT, you can set a lower 'max\_threads'.
For example, if the necessary number of entries are located in every block and max\_threads = 8, then 8 blocks are retrieved, although it would have been enough to read just one.
The smaller the `max_threads` value, the less memory is consumed.

The `max_threads` setting by default matches the number of hardware threads (number of CPU cores) available to ClickHouse.
As a special case, for x86 processors with less than 32 CPU cores and SMT (e.g. Intel HyperThreading), ClickHouse uses the number of logical cores (= 2 x physical core count) by default.

Without SMT (e.g. Intel HyperThreading), this corresponds to the number of CPU cores.

For ClickHouse Cloud users, the default value will display as `auto(N)` where N matches the vCPU size of your service e.g. 2vCPU/8GiB, 4vCPU/16GiB etc.
See the settings tab in the Cloud console for a list of all service sizes.

<h2 id="max_threads_for_indexes">
  max\_threads\_for\_indexes
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The maximum number of threads process indices.

<h2 id="max_threads_min_free_memory_per_thread">
  max\_threads\_min\_free\_memory\_per\_thread
</h2>

<SettingsInfoBlock type="UInt64" default_value="1073741824" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1073741824"},{"label": "New setting to limit the number of threads based on available free memory"}]}]} />

Lowers `max_threads` when the server is under memory pressure, to avoid starting highly-parallel queries that are likely to hit the memory limit.

Free memory is computed as the server's `max_server_memory_usage` minus the memory currently tracked by the global memory tracker. If that free memory is less than `max_threads` multiplied by this value, `max_threads` is reduced to the largest N such that `N * value <= free_memory`, with a minimum of `1`.

Set to `0` to disable this limit.

For example, with the default of 1 GiB and 32 GiB of free memory, `max_threads` is capped at 32; with 1 GiB of free memory it falls back to 1.

This setting applies to read-side parallelism (`SELECT`, `UNION`, `INTERSECT`/`EXCEPT`, and the `SELECT` side of `INSERT ... SELECT`). For the write side, see `max_insert_threads_min_free_memory_per_thread`.

<h2 id="max_untracked_memory">
  max\_untracked\_memory
</h2>

<SettingsInfoBlock type="UInt64" default_value="4194304" />

Small allocations and deallocations are grouped in thread local variable and tracked or profiled only when an amount (in absolute value) becomes larger than the specified value. If the value is higher than 'memory\_profiler\_step' it will be effectively lowered to 'memory\_profiler\_step'.

<h2 id="max_wkb_geometry_elements">
  max\_wkb\_geometry\_elements
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1000000"},{"label": "New setting to limit element counts in WKB geometry parsing, preventing excessive memory allocation on malformed data."}]}]} />

Maximum number of points, rings, or polygons allowed in a single WKB geometry element during parsing by `readWKB` and related functions. This protects against excessive memory allocations from malformed WKB data. Set to 0 to use the hard-coded limit (100 million).

<h2 id="memory_overcommit_ratio_denominator">
  memory\_overcommit\_ratio\_denominator
</h2>

<SettingsInfoBlock type="UInt64" default_value="1073741824" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.5"},{"label": "1073741824"},{"label": "Enable memory overcommit feature by default"}]}]} />

It represents the soft memory limit when the hard limit is reached on the global level.
This value is used to compute the overcommit ratio for the query.
Zero means skip the query.
Read more about [memory overcommit](/concepts/features/configuration/settings/memory-overcommit).

<h2 id="memory_overcommit_ratio_denominator_for_user">
  memory\_overcommit\_ratio\_denominator\_for\_user
</h2>

<SettingsInfoBlock type="UInt64" default_value="1073741824" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.5"},{"label": "1073741824"},{"label": "Enable memory overcommit feature by default"}]}]} />

It represents the soft memory limit when the hard limit is reached on the user level.
This value is used to compute the overcommit ratio for the query.
Zero means skip the query.
Read more about [memory overcommit](/concepts/features/configuration/settings/memory-overcommit).

<h2 id="memory_profiler_sample_max_allocation_size">
  memory\_profiler\_sample\_max\_allocation\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Collect random allocations of size less or equal than the specified value with probability equal to `memory_profiler_sample_probability`. 0 means disabled. You may want to set 'max\_untracked\_memory' to 0 to make this threshold work as expected.

<h2 id="memory_profiler_sample_min_allocation_size">
  memory\_profiler\_sample\_min\_allocation\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Collect random allocations of size greater or equal than the specified value with probability equal to `memory_profiler_sample_probability`. 0 means disabled. You may want to set 'max\_untracked\_memory' to 0 to make this threshold work as expected.

<h2 id="memory_profiler_sample_probability">
  memory\_profiler\_sample\_probability
</h2>

<SettingsInfoBlock type="Float" default_value="0" />

Collect random allocations and deallocations and write them into system.trace\_log with 'MemorySample' trace\_type. The probability is for every alloc/free regardless of the size of the allocation (can be changed with `memory_profiler_sample_min_allocation_size` and `memory_profiler_sample_max_allocation_size`). Note that sampling happens only when the amount of untracked memory exceeds 'max\_untracked\_memory'. You may want to set 'max\_untracked\_memory' to 0 for extra fine-grained sampling.

<h2 id="memory_profiler_step">
  memory\_profiler\_step
</h2>

<SettingsInfoBlock type="UInt64" default_value="4194304" />

Sets the step of memory profiler. Whenever query memory usage becomes larger than every next step in number of bytes the memory profiler will collect the allocating stacktrace and will write it into [trace\_log](/reference/system-tables/trace_log).

Possible values:

* A positive integer number of bytes.

* 0 for turning off the memory profiler.

<h2 id="memory_tracker_fault_probability">
  memory\_tracker\_fault\_probability
</h2>

<SettingsInfoBlock type="Float" default_value="0" />

For testing of `exception safety` - throw an exception every time you allocate memory with the specified probability.

<h2 id="memory_usage_overcommit_max_wait_microseconds">
  memory\_usage\_overcommit\_max\_wait\_microseconds
</h2>

<SettingsInfoBlock type="UInt64" default_value="5000000" />

Maximum time thread will wait for memory to be freed in the case of memory overcommit on a user level.
If the timeout is reached and memory is not freed, an exception is thrown.
Read more about [memory overcommit](/concepts/features/configuration/settings/memory-overcommit).

<h2 id="merge_table_max_tables_to_look_for_schema_inference">
  merge\_table\_max\_tables\_to\_look\_for\_schema\_inference
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1000"},{"label": "A new setting"}]}]} />

When creating a `Merge` table without an explicit schema or when using the `merge` table function, infer schema as a union of not more than the specified number of matching tables.
If there is a larger number of tables, the schema will be inferred from the first specified number of tables.

<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>

<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.

<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_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](/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](/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](/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](/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](/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](/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.

<h2 id="metrics_perf_events_enabled">
  metrics\_perf\_events\_enabled
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

If enabled, some of the perf events will be measured throughout queries' execution.

<h2 id="metrics_perf_events_list">
  metrics\_perf\_events\_list
</h2>

Comma separated list of perf metrics that will be measured throughout queries' execution. Empty means all events. See PerfEventInfo in sources for the available events.

<h2 id="min_bytes_to_use_direct_io">
  min\_bytes\_to\_use\_direct\_io
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The minimum data volume required for using direct I/O access to the storage disk.

ClickHouse uses this setting when reading data from tables. If the total storage volume of all the data to be read exceeds `min_bytes_to_use_direct_io` bytes, then ClickHouse reads the data from the storage disk with the `O_DIRECT` option.

Possible values:

* 0 — Direct I/O is disabled.
* Positive integer.

<h2 id="min_bytes_to_use_mmap_io">
  min\_bytes\_to\_use\_mmap\_io
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

This is an experimental setting. Sets the minimum amount of memory for reading large files without copying data from the kernel to userspace. Recommended threshold is about 64 MB, because [mmap/munmap](https://en.wikipedia.org/wiki/Mmap) is slow. It makes sense only for large files and helps only if data reside in the page cache.

Possible values:

* Positive integer.
* 0 — Big files read with only copying data from kernel to userspace.

<h2 id="min_chunk_bytes_for_parallel_parsing">
  min\_chunk\_bytes\_for\_parallel\_parsing
</h2>

<SettingsInfoBlock type="NonZeroUInt64" default_value="10485760" />

* Type: unsigned int
* Default value: 1 MiB

The minimum chunk size in bytes, which each thread will parse in parallel.

<h2 id="min_compress_block_size">
  min\_compress\_block\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="65536" />

For [MergeTree](/reference/engines/table-engines/mergetree-family/mergetree) tables. In order to reduce latency when processing queries, a block is compressed when writing the next mark if its size is at least `min_compress_block_size`. By default, 65,536.

The actual size of the block, if the uncompressed data is less than `max_compress_block_size`, is no less than this value and no less than the volume of data for one mark.

Let's look at an example. Assume that `index_granularity` was set to 8192 during table creation.

We are writing a UInt32-type column (4 bytes per value). When writing 8192 rows, the total will be 32 KB of data. Since min\_compress\_block\_size = 65,536, a compressed block will be formed for every two marks.

We are writing a URL column with the String type (average size of 60 bytes per value). When writing 8192 rows, the average will be slightly less than 500 KB of data. Since this is more than 65,536, a compressed block will be formed for each mark. In this case, when reading data from the disk in the range of a single mark, extra data won't be decompressed.

<Note>
  This is an expert-level setting, and you shouldn't change it if you're just getting started with ClickHouse.
</Note>

<h2 id="min_count_to_compile_aggregate_expression">
  min\_count\_to\_compile\_aggregate\_expression
</h2>

<SettingsInfoBlock type="UInt64" default_value="3" />

The minimum number of identical aggregate expressions to start JIT-compilation. Works only if the [compile\_aggregate\_expressions](#compile_aggregate_expressions) setting is enabled.

Possible values:

* Positive integer.
* 0 — Identical aggregate expressions are always JIT-compiled.

<h2 id="min_count_to_compile_expression">
  min\_count\_to\_compile\_expression
</h2>

<SettingsInfoBlock type="UInt64" default_value="3" />

Minimum count of executing same expression before it is get compiled.

<h2 id="min_count_to_compile_sort_description">
  min\_count\_to\_compile\_sort\_description
</h2>

<SettingsInfoBlock type="UInt64" default_value="3" />

The number of identical sort descriptions before they are JIT-compiled

<h2 id="min_execution_speed">
  min\_execution\_speed
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Minimal execution speed in rows per second. Checked on every data block when
[`timeout_before_checking_execution_speed`](/reference/settings/session-settings#timeout_before_checking_execution_speed)
expires. If the execution speed is lower, an exception is thrown.

<h2 id="min_execution_speed_bytes">
  min\_execution\_speed\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The minimum number of execution bytes per second. Checked on every data block when
[`timeout_before_checking_execution_speed`](/reference/settings/session-settings#timeout_before_checking_execution_speed)
expires. If the execution speed is lower, an exception is thrown.

<h2 id="min_external_table_block_size_bytes">
  min\_external\_table\_block\_size\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="268402944" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "268402944"},{"label": "Squash blocks passed to external table to specified size in bytes, if blocks are not big enough."}]}]} />

Squash blocks passed to the external table to a specified size in bytes, if blocks are not big enough.

<h2 id="min_external_table_block_size_rows">
  min\_external\_table\_block\_size\_rows
</h2>

<SettingsInfoBlock type="UInt64" default_value="1048449" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "1048449"},{"label": "Squash blocks passed to external table to specified size in rows, if blocks are not big enough"}]}]} />

Squash blocks passed to external table to specified size in rows, if blocks are not big enough.

<h2 id="min_filtered_ratio_for_lazy_final">
  min\_filtered\_ratio\_for\_lazy\_final
</h2>

<SettingsInfoBlock type="Float" default_value="0.5" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0.5"},{"label": "New setting for minimum ratio of marks filtered for lazy FINAL optimization to proceed"}]}]} />

Minimum ratio of marks filtered by index analysis for lazy FINAL optimization. If less than this fraction of marks is filtered, falls back to normal FINAL. Value 0 disables this check.

<h2 id="min_free_disk_bytes_to_perform_insert">
  min\_free\_disk\_bytes\_to\_perform\_insert
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "0"},{"label": "Maintain some free disk space bytes from inserts while still allowing for temporary writing."}]}, {"id": "row-2","items": [{"label": "24.10"},{"label": "0"},{"label": "New setting."}]}]} />

Minimum free disk space bytes to perform an insert.

<h2 id="min_free_disk_ratio_to_perform_insert">
  min\_free\_disk\_ratio\_to\_perform\_insert
</h2>

<SettingsInfoBlock type="Float" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "0"},{"label": "Maintain some free disk space bytes expressed as ratio to total disk space from inserts while still allowing for temporary writing."}]}, {"id": "row-2","items": [{"label": "24.10"},{"label": "0"},{"label": "New setting."}]}]} />

Minimum free disk space ratio to perform an insert.

<h2 id="min_free_disk_space_for_temporary_data">
  min\_free\_disk\_space\_for\_temporary\_data
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The minimum disk space to keep while writing temporary data used in external sorting and aggregation.

<h2 id="min_hit_rate_to_use_consecutive_keys_optimization">
  min\_hit\_rate\_to\_use\_consecutive\_keys\_optimization
</h2>

<SettingsInfoBlock type="Float" default_value="0.5" />

Minimal hit rate of a cache which is used for consecutive keys optimization in aggregation to keep it enabled

<h2 id="min_insert_block_size_bytes">
  min\_insert\_block\_size\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="268402944" />

The minimum size of blocks (in bytes) to form for insertion into a table.

This setting works together with min\_insert\_block\_size\_rows and controls block formation in the same contexts (format parsing and INSERT operations). See min\_insert\_block\_size\_rows for detailed information about when and how these settings are applied.

Possible values:

* Positive integer.
* 0 — setting does not participate in block formation.

<h2 id="min_insert_block_size_bytes_for_materialized_views">
  min\_insert\_block\_size\_bytes\_for\_materialized\_views
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Sets the minimum number of bytes in the block which can be inserted into a table by an `INSERT` query. Smaller-sized blocks are squashed into bigger ones. This setting is applied only for blocks inserted into [materialized view](/reference/statements/create/view). By adjusting this setting, you control blocks squashing while pushing to materialized view and avoid excessive memory usage.

Possible values:

* Any positive integer.
* 0 — Squashing disabled.

**See also**

* [min\_insert\_block\_size\_bytes](#min_insert_block_size_bytes)

<h2 id="min_insert_block_size_rows">
  min\_insert\_block\_size\_rows
</h2>

<SettingsInfoBlock type="UInt64" default_value="1048449" />

The minimum size of blocks (in rows) to form for insertion into a table.

This setting controls block formation in two contexts:

1. Format parsing: When the server parses row-based input formats (CSV, TSV, JSONEachRow, etc.) from any interface (HTTP, clickhouse-client with inline data, gRPC, PostgreSQL wire protocol), blocks are emitted when:

   * Both min\_insert\_block\_size\_rows AND min\_insert\_block\_size\_bytes are reached, OR
   * Either max\_insert\_block\_size\_rows OR max\_insert\_block\_size\_bytes is reached

   Note: When using clickhouse-client or clickhouse-local to read from a file, the client itself parses the data and this setting applies on the client side.

2. INSERT operations: During INSERT queries and when data flows through materialized views, this setting's behavior depends on `use_strict_insert_block_limits`:

   * When enabled: Blocks are emitted when:
     * Min thresholds (AND): Both min\_insert\_block\_size\_rows AND min\_insert\_block\_size\_bytes are reached
     * Max thresholds (OR): Either max\_insert\_block\_size\_rows OR max\_insert\_block\_size\_bytes is reached

   * When disabled (default): Blocks are emitted when min\_insert\_block\_size\_rows OR min\_insert\_block\_size\_bytes is reached. The max\_insert\_block\_size settings are not enforced.

Possible values:

* Positive integer.
* 0 — setting does not participate in block formation.

<h2 id="min_insert_block_size_rows_for_materialized_views">
  min\_insert\_block\_size\_rows\_for\_materialized\_views
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Sets the minimum number of rows in the block which can be inserted into a table by an `INSERT` query. Smaller-sized blocks are squashed into bigger ones. This setting is applied only for blocks inserted into [materialized view](/reference/statements/create/view). By adjusting this setting, you control blocks squashing while pushing to materialized view and avoid excessive memory usage.

Possible values:

* Any positive integer.
* 0 — Squashing disabled.

**See Also**

* [min\_insert\_block\_size\_rows](#min_insert_block_size_rows)

<h2 id="min_joined_block_size_bytes">
  min\_joined\_block\_size\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="524288" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "524288"},{"label": "New setting."}]}]} />

Minimum block size in bytes for JOIN input and output blocks (if join algorithm supports it). Small blocks will be squashed. 0 means unlimited.

<h2 id="min_joined_block_size_rows">
  min\_joined\_block\_size\_rows
</h2>

<SettingsInfoBlock type="UInt64" default_value="65409" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "65409"},{"label": "New setting."}]}]} />

Minimum block size in rows for JOIN input and output blocks (if join algorithm supports it). Small blocks will be squashed. 0 means unlimited.

<h2 id="min_os_cpu_wait_time_ratio_to_throw">
  min\_os\_cpu\_wait\_time\_ratio\_to\_throw
</h2>

<SettingsInfoBlock type="Float" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "0"},{"label": "Setting values were changed and backported to 25.4"}]}, {"id": "row-2","items": [{"label": "25.4"},{"label": "0"},{"label": "New setting"}]}]} />

Min ratio between OS CPU wait (OSCPUWaitMicroseconds metric) and busy (OSCPUVirtualTimeMicroseconds metric) times to consider rejecting queries. Linear interpolation between min and max ratio is used to calculate the probability, the probability is 0 at this point.

<h2 id="min_outstreams_per_resize_after_split">
  min\_outstreams\_per\_resize\_after\_split
</h2>

<SettingsInfoBlock type="UInt64" default_value="24" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "24"},{"label": "New setting."}]}]} />

Specifies the minimum number of output streams of a `Resize` or `StrictResize` processor after the split is performed during pipeline generation. If the resulting number of streams is less than this value, the split operation will not occur.

### What is a Resize Node

A `Resize` node is a processor in the query pipeline that adjusts the number of data streams flowing through the pipeline. It can either increase or decrease the number of streams to balance the workload across multiple threads or processors. For example, if a query requires more parallelism, the `Resize` node can split a single stream into multiple streams. Conversely, it can merge multiple streams into fewer streams to consolidate data processing.

The `Resize` node ensures that data is evenly distributed across streams, maintaining the structure of the data blocks. This helps optimize resource utilization and improve query performance.

### Why the Resize Node Needs to Be Split

During pipeline execution, ExecutingGraph::Node::status\_mutex of the centrally-hubbed `Resize` node is heavily contended especially in high-core-count environments, and this contention leads to:

1. Increased latency for ExecutingGraph::updateNode, directly impacting query performance.
2. Excessive CPU cycles are wasted in spin-lock contention (native\_queued\_spin\_lock\_slowpath), degrading efficiency.
3. Reduced CPU utilization, limiting parallelism and throughput.

### How the Resize Node Gets Split

1. The number of output streams is checked to ensure the split could be performed: the output streams of each split processor meet or exceed the `min_outstreams_per_resize_after_split` threshold.
2. The `Resize` node is divided into smaller `Resize` nodes with equal count of ports, each handling a subset of input and output streams.
3. Each group is processed independently, reducing the lock contention.

### Splitting Resize Node with Arbitrary Inputs/Outputs

In some cases, where the inputs/outputs are indivisible by the number of split `Resize` nodes, some inputs are connected to `NullSource`s and some outputs are connected to `NullSink`s. This allows the split to occur without affecting the overall data flow.

### Purpose of the Setting

The `min_outstreams_per_resize_after_split` setting ensures that the splitting of `Resize` nodes is meaningful and avoids creating too few streams, which could lead to inefficient parallel processing. By enforcing a minimum number of output streams, this setting helps maintain a balance between parallelism and overhead, optimizing query execution in scenarios involving stream splitting and merging.

### Disabling the Setting

To disable the split of `Resize` nodes, set this setting to 0. This will prevent the splitting of `Resize` nodes during pipeline generation, allowing them to retain their original structure without division into smaller nodes.

<h2 id="min_table_rows_to_use_projection_index">
  min\_table\_rows\_to\_use\_projection\_index
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1000000"},{"label": "New setting"}]}]} />

If the estimated number of rows to read from the table is greater than or equal to this threshold, ClickHouse will try to use the projection index during query execution.

<h2 id="mongodb_throw_on_unsupported_query">
  mongodb\_throw\_on\_unsupported\_query
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "1"},{"label": "New setting."}]}, {"id": "row-2","items": [{"label": "24.10"},{"label": "1"},{"label": "New setting."}]}]} />

If enabled, MongoDB tables will return an error when a MongoDB query cannot be built. Otherwise, ClickHouse reads the full table and processes it locally. This option does not apply when 'allow\_experimental\_analyzer=0'.

<h2 id="move_all_conditions_to_prewhere">
  move\_all\_conditions\_to\_prewhere
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Move all viable conditions from WHERE to PREWHERE

<h2 id="move_primary_key_columns_to_end_of_prewhere">
  move\_primary\_key\_columns\_to\_end\_of\_prewhere
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Move PREWHERE conditions containing primary key columns to the end of AND chain. It is likely that these conditions are taken into account during primary key analysis and thus will not contribute a lot to PREWHERE filtering.

<h2 id="multiple_joins_try_to_keep_original_names">
  multiple\_joins\_try\_to\_keep\_original\_names
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Do not add aliases to top level expression list on multiple joins rewrite

<h2 id="mutations_execute_nondeterministic_on_initiator">
  mutations\_execute\_nondeterministic\_on\_initiator
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

If true constant nondeterministic functions (e.g. function `now()`) are executed on initiator and replaced to literals in `UPDATE` and `DELETE` queries. It helps to keep data in sync on replicas while executing mutations with constant nondeterministic functions. Default value: `false`.

<h2 id="mutations_execute_subqueries_on_initiator">
  mutations\_execute\_subqueries\_on\_initiator
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

If true scalar subqueries are executed on initiator and replaced to literals in `UPDATE` and `DELETE` queries. Default value: `false`.

<h2 id="mutations_max_literal_size_to_replace">
  mutations\_max\_literal\_size\_to\_replace
</h2>

<SettingsInfoBlock type="UInt64" default_value="16384" />

The maximum size of serialized literal in bytes to replace in `UPDATE` and `DELETE` queries. Takes effect only if at least one the two settings above is enabled. Default value: 16384 (16 KiB).

<h2 id="mutations_sync">
  mutations\_sync
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Allows to execute `ALTER TABLE ... UPDATE|DELETE|MATERIALIZE INDEX|MATERIALIZE PROJECTION|MATERIALIZE COLUMN|MATERIALIZE STATISTICS` queries ([mutations](/reference/statements/alter/index#mutations)) synchronously.

Possible values:

| Value | Description                                                                                                                                            |
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `0`   | Mutations execute asynchronously.                                                                                                                      |
| `1`   | The query waits for all mutations to complete on the current server.                                                                                   |
| `2`   | The query waits for all mutations to complete on all replicas (if they exist).                                                                         |
| `3`   | The query waits only for active replicas. Supported only for `SharedMergeTree`. For `ReplicatedMergeTree` it behaves the same as `mutations_sync = 2`. |

<h2 id="mysql_datatypes_support_level">
  mysql\_datatypes\_support\_level
</h2>

<SettingsInfoBlock type="MySQLDataTypesSupport" default_value="decimal,datetime64,date2Date32" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "decimal,datetime64,date2Date32"},{"label": "Enable modern MySQL type mappings by default."}]}]} />

Defines how MySQL types are converted to corresponding ClickHouse types. A comma separated list in any combination of `decimal`, `datetime64`, `date2Date32` or `date2String`. All modern mappings (`decimal`, `datetime64`, `date2Date32`) are enabled by default.

* `decimal`: convert `NUMERIC` and `DECIMAL` types to `Decimal` when precision allows it.
* `datetime64`: convert `DATETIME` and `TIMESTAMP` types to `DateTime64` instead of `DateTime` when precision is not `0`.
* `date2Date32`: convert `DATE` to `Date32` instead of `Date`. Takes precedence over `date2String`.
* `date2String`: convert `DATE` to `String` instead of `Date`. Overridden by `datetime64`.

<h2 id="mysql_map_fixed_string_to_text_in_show_columns">
  mysql\_map\_fixed\_string\_to\_text\_in\_show\_columns
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "1"},{"label": "Reduce the configuration effort to connect ClickHouse with BI tools."}]}]} />

When enabled, [FixedString](/reference/data-types/fixedstring) ClickHouse data type will be displayed as `TEXT` in [SHOW COLUMNS](/reference/statements/show#show_columns).

Has an effect only when the connection is made through the MySQL wire protocol.

* 0 - Use `BLOB`.
* 1 - Use `TEXT`.

<h2 id="mysql_map_string_to_text_in_show_columns">
  mysql\_map\_string\_to\_text\_in\_show\_columns
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "1"},{"label": "Reduce the configuration effort to connect ClickHouse with BI tools."}]}]} />

When enabled, [String](/reference/data-types/string) ClickHouse data type will be displayed as `TEXT` in [SHOW COLUMNS](/reference/statements/show#show_columns).

Has an effect only when the connection is made through the MySQL wire protocol.

* 0 - Use `BLOB`.
* 1 - Use `TEXT`.

<h2 id="mysql_max_rows_to_insert">
  mysql\_max\_rows\_to\_insert
</h2>

<SettingsInfoBlock type="UInt64" default_value="65536" />

The maximum number of rows in MySQL batch insertion of the MySQL storage engine

<h2 id="network_compression_method">
  network\_compression\_method
</h2>

<SettingsInfoBlock type="String" default_value="LZ4" />

The codec for compressing the client/server and server/server communication.

Possible values:

* `NONE` — no compression.
* `LZ4` — use the LZ4 codec.
* `LZ4HC` — use the LZ4HC codec.
* `ZSTD` — use the ZSTD codec.

**See Also**

* [network\_zstd\_compression\_level](#network_zstd_compression_level)

<h2 id="network_zstd_compression_level">
  network\_zstd\_compression\_level
</h2>

<SettingsInfoBlock type="Int64" default_value="1" />

Adjusts the level of ZSTD compression. Used only when [network\_compression\_method](#network_compression_method) is set to `ZSTD`.

Possible values:

* Positive integer from 1 to 15.

<h2 id="normalize_function_names">
  normalize\_function\_names
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.3"},{"label": "1"},{"label": "Normalize function names to their canonical names, this was needed for projection query routing"}]}]} />

Normalize function names to their canonical names

<h2 id="number_of_mutations_to_delay">
  number\_of\_mutations\_to\_delay
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

If the mutated table contains at least that many unfinished mutations, artificially slow down mutations of table. 0 - disabled

<h2 id="number_of_mutations_to_throw">
  number\_of\_mutations\_to\_throw
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

If the mutated table contains at least that many unfinished mutations, throw 'Too many mutations ...' exception. 0 - disabled

<h2 id="odbc_bridge_connection_pool_size">
  odbc\_bridge\_connection\_pool\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="16" />

Connection pool size for each connection settings string in ODBC bridge.

<h2 id="odbc_bridge_use_connection_pooling">
  odbc\_bridge\_use\_connection\_pooling
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Use connection pooling in ODBC bridge. If set to false, a new connection is created every time.

<h2 id="offset">
  offset
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Sets the number of rows to skip before starting to return rows from the query. It adjusts the offset set by the [OFFSET](/reference/statements/select/offset) clause, so that these two values are summarized.

Possible values:

* 0 — No rows are skipped .
* Positive integer.

**Example**

Input table:

```sql theme={null}
CREATE TABLE test (i UInt64) ENGINE = MergeTree() ORDER BY i;
INSERT INTO test SELECT number FROM numbers(500);
```

Query:

```sql theme={null}
SET limit = 5;
SET offset = 7;
SELECT * FROM test LIMIT 10 OFFSET 100;
```

Result:

```text theme={null}
┌───i─┐
│ 107 │
│ 108 │
│ 109 │
└─────┘
```

<h2 id="opentelemetry_start_keeper_trace_probability">
  opentelemetry\_start\_keeper\_trace\_probability
</h2>

<SettingsInfoBlock type="FloatAuto" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "auto"},{"label": "New setting"}]}]} />

Probability to start a trace for ZooKeeper request - whether there is a parent trace or not.

Possible values:

* 'auto' - Equals the opentelemetry\_start\_trace\_probability setting
* 0 — Tracing is disabled
* 0 to 1 — Probability (e.g., 1.0 = always enable)

<h2 id="opentelemetry_start_trace_probability">
  opentelemetry\_start\_trace\_probability
</h2>

<SettingsInfoBlock type="Float" default_value="0" />

Sets the probability that the ClickHouse can start a trace for executed queries (if no parent [trace context](https://www.w3.org/TR/trace-context/) is supplied).

Possible values:

* 0 — The trace for all executed queries is disabled (if no parent trace context is supplied).
* Positive floating-point number in the range \[0..1]. For example, if the setting value is `0,5`, ClickHouse can start a trace on average for half of the queries.
* 1 — The trace for all executed queries is enabled.

<h2 id="opentelemetry_trace_cpu_scheduling">
  opentelemetry\_trace\_cpu\_scheduling
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "0"},{"label": "New setting to trace `cpu_slot_preemption` feature."}]}]} />

Collect OpenTelemetry spans for workload preemptive CPU scheduling.

<h2 id="opentelemetry_trace_processors">
  opentelemetry\_trace\_processors
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Collect OpenTelemetry spans for processors.

<h2 id="optimize_aggregation_in_order">
  optimize\_aggregation\_in\_order
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables [GROUP BY](/reference/statements/select/group-by) optimization in [SELECT](/reference/statements/select/index) queries for aggregating data in corresponding order in [MergeTree](/reference/engines/table-engines/mergetree-family/mergetree) tables.

Possible values:

* 0 — `GROUP BY` optimization is disabled.
* 1 — `GROUP BY` optimization is enabled.

**See Also**

* [GROUP BY optimization](/reference/statements/select/group-by#group-by-optimization-depending-on-table-sorting-key)

<h2 id="optimize_aggregators_of_group_by_keys">
  optimize\_aggregators\_of\_group\_by\_keys
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Eliminates min/max/any/anyLast aggregators of GROUP BY keys in SELECT sectio

<h2 id="optimize_and_compare_chain">
  optimize\_and\_compare\_chain
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "1"},{"label": "A new setting"}]}]} />

Populate constant comparison in AND chains to enhance filtering ability. Support operators `<`, `<=`, `>`, `>=`, `=` and mix of them. For example, `(a < b) AND (b < c) AND (c < 5)` would be `(a < b) AND (b < c) AND (c < 5) AND (b < 5) AND (a < 5)`.

<h2 id="optimize_append_index">
  optimize\_append\_index
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Use [constraints](/reference/statements/create/table#constraints) in order to append index condition. The default is `false`.

Possible values:

* true, false

<h2 id="optimize_arithmetic_operations_in_aggregate_functions">
  optimize\_arithmetic\_operations\_in\_aggregate\_functions
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Move arithmetic operations out of aggregation functions

<h2 id="optimize_const_name_size">
  optimize\_const\_name\_size
</h2>

<SettingsInfoBlock type="Int64" default_value="256" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "256"},{"label": "Replace with scalar and use hash as a name for large constants (size is estimated by name length)"}]}]} />

Replace with scalar and use hash as a name for large constants (size is estimated by the name length).

Possible values:

* positive integer - max length of the name,
* 0 — always,
* negative integer - never.

<h2 id="optimize_count_from_files">
  optimize\_count\_from\_files
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enables or disables the optimization of counting number of rows from files in different input formats. It applies to table functions/engines `file`/`s3`/`url`/`hdfs`/`azureBlobStorage`.

Possible values:

* 0 — Optimization disabled.
* 1 — Optimization enabled.

<h2 id="optimize_dictget_tuple_element">
  optimize\_dictget\_tuple\_element
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1"},{"label": "Rewrite tupleElement(dictGet(..., tuple_of_attrs, ...), N) into a single-attribute dictGet call."}]}]} />

Rewrite `tupleElement(dictGet('dict', ('a', 'b', 'c'), key), 2)` into `dictGet('dict', 'b', key)` to avoid fetching unnecessary dictionary attributes. Supports positional (`.1`, `.2`, ...) and named (`.b`) access, and also applies to `dictGetOrDefault` when the default argument is a constant tuple or a `tuple(...)` of constants.

<h2 id="optimize_distinct_in_order">
  optimize\_distinct\_in\_order
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enable DISTINCT optimization if some columns in DISTINCT form a prefix of sorting. For example, prefix of sorting key in merge tree or ORDER BY statement

<h2 id="optimize_distributed_group_by_sharding_key">
  optimize\_distributed\_group\_by\_sharding\_key
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Optimize `GROUP BY sharding_key` queries, by avoiding costly aggregation on the initiator server (which will reduce memory usage for the query on the initiator server).

The following types of queries are supported (and all combinations of them):

* `SELECT DISTINCT [..., ]sharding_key[, ...] FROM dist`
* `SELECT ... FROM dist GROUP BY sharding_key[, ...]`
* `SELECT ... FROM dist GROUP BY sharding_key[, ...] ORDER BY x`
* `SELECT ... FROM dist GROUP BY sharding_key[, ...] LIMIT 1`
* `SELECT ... FROM dist GROUP BY sharding_key[, ...] LIMIT 1 BY x`

The following types of queries are not supported (support for some of them may be added later):

* `SELECT ... GROUP BY sharding_key[, ...] WITH TOTALS`
* `SELECT ... GROUP BY sharding_key[, ...] WITH ROLLUP`
* `SELECT ... GROUP BY sharding_key[, ...] WITH CUBE`
* `SELECT ... GROUP BY sharding_key[, ...] SETTINGS extremes=1`

Possible values:

* 0 — Disabled.
* 1 — Enabled.

See also:

* [distributed\_group\_by\_no\_merge](#distributed_group_by_no_merge)
* [distributed\_push\_down\_limit](#distributed_push_down_limit)
* [optimize\_skip\_unused\_shards](#optimize_skip_unused_shards)

<Note>
  Right now it requires `optimize_skip_unused_shards` (the reason behind this is that one day it may be enabled by default, and it will work correctly only if data was inserted via Distributed table, i.e. data is distributed according to sharding\_key).
</Note>

<h2 id="optimize_dry_run_check_part">
  optimize\_dry\_run\_check\_part
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "New setting"}]}]} />

When enabled, `OPTIMIZE ... DRY RUN` validates the resulting merged part using `checkDataPart`. If the check fails, an exception is thrown.

<h2 id="optimize_empty_string_comparisons">
  optimize\_empty\_string\_comparisons
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "1"},{"label": "A new setting."}]}]} />

Convert expressions like col = '' or '' = col into empty(col), and col != '' or '' != col into notEmpty(col),
only when col is of String or FixedString type.

<h2 id="optimize_extract_common_expressions">
  optimize\_extract\_common\_expressions
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "Optimize WHERE, PREWHERE, ON, HAVING and QUALIFY expressions by extracting common expressions out from disjunction of conjunctions."}]}, {"id": "row-2","items": [{"label": "24.12"},{"label": "0"},{"label": "Introduce setting to optimize WHERE, PREWHERE, ON, HAVING and QUALIFY expressions by extracting common expressions out from disjunction of conjunctions."}]}]} />

Allow extracting common expressions from disjunctions in WHERE, PREWHERE, ON, HAVING and QUALIFY expressions. A logical expression like `(A AND B) OR (A AND C)` can be rewritten to `A AND (B OR C)`, which might help to utilize:

* indices in simple filtering expressions
* cross to inner join optimizatio

<h2 id="optimize_functions_to_subcolumns">
  optimize\_functions\_to\_subcolumns
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "1"},{"label": "Enabled settings by default"}]}]} />

Enables or disables optimization by transforming some functions to reading subcolumns. This reduces the amount of data to read.

These functions can be transformed:

* [length](/reference/functions/regular-functions/array-functions#length) to read the [size0](/reference/data-types/array#array-size) subcolumn.
* [empty](/reference/functions/regular-functions/array-functions#empty) to read the [size0](/reference/data-types/array#array-size) subcolumn.
* [notEmpty](/reference/functions/regular-functions/array-functions#notEmpty) to read the [size0](/reference/data-types/array#array-size) subcolumn.
* [isNull](/reference/functions/regular-functions/functions-for-nulls#isNull) to read the [null](/reference/data-types/nullable#finding-null) subcolumn.
* [isNotNull](/reference/functions/regular-functions/functions-for-nulls#isNotNull) to read the [null](/reference/data-types/nullable#finding-null) subcolumn.
* [count](/reference/functions/aggregate-functions/count) to read the [null](/reference/data-types/nullable#finding-null) subcolumn.
* [mapKeys](/reference/functions/regular-functions/tuple-map-functions#mapKeys) to read the [keys](/reference/data-types/map#reading-subcolumns-of-map) subcolumn.
* [mapValues](/reference/functions/regular-functions/tuple-map-functions#mapValues) to read the [values](/reference/data-types/map#reading-subcolumns-of-map) subcolumn.

Possible values:

* 0 — Optimization disabled.
* 1 — Optimization enabled.

<h2 id="optimize_group_by_constant_keys">
  optimize\_group\_by\_constant\_keys
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.9"},{"label": "1"},{"label": "Optimize group by constant keys by default"}]}]} />

Optimize GROUP BY when all keys in block are constant

<h2 id="optimize_group_by_function_keys">
  optimize\_group\_by\_function\_keys
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Eliminates functions of other keys in GROUP BY sectio

<h2 id="optimize_if_chain_to_multiif">
  optimize\_if\_chain\_to\_multiif
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Replace if(cond1, then1, if(cond2, ...)) chains to multiIf. Currently it's not beneficial for numeric types.

<h2 id="optimize_if_transform_strings_to_enum">
  optimize\_if\_transform\_strings\_to\_enum
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Replaces string-type arguments in If and Transform to enum. Disabled by default cause it could make inconsistent change in distributed query that would lead to its fail.

<h2 id="optimize_injective_functions_in_group_by">
  optimize\_injective\_functions\_in\_group\_by
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "1"},{"label": "Replace injective functions by it's arguments in GROUP BY section in analyzer"}]}]} />

Replaces injective functions by it's arguments in GROUP BY sectio

<h2 id="optimize_injective_functions_in_limit_by">
  optimize\_injective\_functions\_in\_limit\_by
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1"},{"label": "New setting that replaces injective functions by their arguments in the LIMIT BY keys."}]}]} />

Replaces injective functions by their arguments in LIMIT BY section.

Example: `LIMIT 5 BY toString(x)` becomes `LIMIT 5 BY x`.

<h2 id="optimize_injective_functions_inside_uniq">
  optimize\_injective\_functions\_inside\_uniq
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Delete injective functions of one argument inside uniq\*() functions.

<h2 id="optimize_inverse_dictionary_lookup">
  optimize\_inverse\_dictionary\_lookup
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "1"},{"label": "New setting"}]}]} />

Avoid repeated inverse dictionary lookup by doing faster lookups into a precomputed set of possible key values.

<h2 id="optimize_limit_by_function_keys">
  optimize\_limit\_by\_function\_keys
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1"},{"label": "New setting that eliminates LIMIT BY keys that are functions of other LIMIT BY keys."}]}]} />

Eliminates functions of other keys in LIMIT BY section.

Example: `LIMIT 5 BY x, f(x)` becomes `LIMIT 5 BY x`.

<h2 id="optimize_limit_by_in_order">
  optimize\_limit\_by\_in\_order
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1"},{"label": "New setting to optimize `LIMIT BY` queries when `BY` columns are a prefix of the table's sorting key."}]}]} />

Optimize `SELECT ... LIMIT N BY <cols>` queries when `<cols>` (in any order) form a prefix of the table's sorting key, or become one after `WHERE col = const` fixes leading columns. With this enabled the source reads data in primary-key order, so rows with equal values of the `BY` columns arrive adjacent to each other within each stream. When the data arrives in a single sorted stream, `LIMIT BY` filters it in streaming mode with O(1) memory, instead of building a hash table of every distinct combination of `BY` columns seen. When the sorted data arrives in multiple streams and the same `BY` values can appear in more than one of them, each stream is first prefiltered in streaming mode down to at most `LIMIT + OFFSET` rows per group, then the streams are combined and a final hash-based `LIMIT BY` deduplicates groups that span several streams. That final pass still keeps an entry for every distinct combination of `BY` columns, but it only processes the prefiltered rows.

<h2 id="optimize_min_equality_disjunction_chain_length">
  optimize\_min\_equality\_disjunction\_chain\_length
</h2>

<SettingsInfoBlock type="UInt64" default_value="3" />

The minimum length of the expression `expr = x1 OR ... expr = xN` for optimizatio

<h2 id="optimize_min_inequality_conjunction_chain_length">
  optimize\_min\_inequality\_conjunction\_chain\_length
</h2>

<SettingsInfoBlock type="UInt64" default_value="3" />

The minimum length of the expression `expr <> x1 AND ... expr <> xN` for optimizatio

<h2 id="optimize_move_to_prewhere">
  optimize\_move\_to\_prewhere
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enables or disables automatic [PREWHERE](/reference/statements/select/prewhere) optimization in [SELECT](/reference/statements/select/index) queries.

Works only for [\*MergeTree](/reference/engines/table-engines/mergetree-family/index) tables.

Possible values:

* 0 — Automatic `PREWHERE` optimization is disabled.
* 1 — Automatic `PREWHERE` optimization is enabled.

<h2 id="optimize_move_to_prewhere_if_final">
  optimize\_move\_to\_prewhere\_if\_final
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables or disables automatic [PREWHERE](/reference/statements/select/prewhere) optimization in [SELECT](/reference/statements/select/index) queries with [FINAL](/reference/statements/select/from#final-modifier) modifier.

Works only for [\*MergeTree](/reference/engines/table-engines/mergetree-family/index) tables.

Possible values:

* 0 — Automatic `PREWHERE` optimization in `SELECT` queries with `FINAL` modifier is disabled.
* 1 — Automatic `PREWHERE` optimization in `SELECT` queries with `FINAL` modifier is enabled.

**See Also**

* [optimize\_move\_to\_prewhere](#optimize_move_to_prewhere) setting

<h2 id="optimize_multiif_to_if">
  optimize\_multiif\_to\_if
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Replace 'multiIf' with only one condition to 'if'.

<h2 id="optimize_normalize_count_variants">
  optimize\_normalize\_count\_variants
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.3"},{"label": "1"},{"label": "Rewrite aggregate functions that semantically equals to count() as count() by default"}]}]} />

Rewrite aggregate functions that semantically equals to count() as count().

<h2 id="optimize_on_insert">
  optimize\_on\_insert
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.1"},{"label": "1"},{"label": "Enable data optimization on INSERT by default for better user experience"}]}]} />

Enables or disables data transformation before the insertion, as if merge was done on this block (according to table engine).

Possible values:

* 0 — Disabled.
* 1 — Enabled.

**Example**

The difference between enabled and disabled:

Query:

```sql theme={null}
SET optimize_on_insert = 1;

CREATE TABLE test1 (`FirstTable` UInt32) ENGINE = ReplacingMergeTree ORDER BY FirstTable;

INSERT INTO test1 SELECT number % 2 FROM numbers(5);

SELECT * FROM test1;

SET optimize_on_insert = 0;

CREATE TABLE test2 (`SecondTable` UInt32) ENGINE = ReplacingMergeTree ORDER BY SecondTable;

INSERT INTO test2 SELECT number % 2 FROM numbers(5);

SELECT * FROM test2;
```

Result:

```text theme={null}
┌─FirstTable─┐
│          0 │
│          1 │
└────────────┘

┌─SecondTable─┐
│           0 │
│           0 │
│           0 │
│           1 │
│           1 │
└─────────────┘
```

Note that this setting influences [Materialized view](/reference/statements/create/view#materialized-view) behaviour.

<h2 id="optimize_or_like_chain">
  optimize\_or\_like\_chain
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Optimize multiple OR LIKE into multiMatchAny. This optimization should not be enabled by default, because it defies index analysis in some cases.

<h2 id="optimize_prewhere_after_pushdown">
  optimize\_prewhere\_after\_pushdown
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "0"},{"label": "New setting that enables a second PREWHERE promotion pass to merge filters deposited above a MergeTree read step by later optimizations (predicate pushdown through JOIN, projection rewrites) into the existing PREWHERE chain."}]}]} />

Run a second `PREWHERE` promotion pass after later query plan optimizations may have
deposited additional filters above a `MergeTree` read step (e.g. predicate pushdown through
`JOIN`, projection rewrites). When an existing `PREWHERE` is already present, the new
filter is `AND`-merged into it instead of staying as a separate filter step.

<h2 id="optimize_qbit_distance_function_reads">
  optimize\_qbit\_distance\_function\_reads
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "1"},{"label": "New setting"}]}]} />

Replace distance functions on `QBit` data type with equivalent ones that only read the columns necessary for the calculation from the storage.

<h2 id="optimize_read_in_order">
  optimize\_read\_in\_order
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enables [ORDER BY](/reference/statements/select/order-by#optimization-of-data-reading) optimization in [SELECT](/reference/statements/select/index) queries for reading data from [MergeTree](/reference/engines/table-engines/mergetree-family/mergetree) tables.

Possible values:

* 0 — `ORDER BY` optimization is disabled.
* 1 — `ORDER BY` optimization is enabled.

**See Also**

* [ORDER BY Clause](/reference/statements/select/order-by#optimization-of-data-reading)

<h2 id="optimize_redundant_functions_in_order_by">
  optimize\_redundant\_functions\_in\_order\_by
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Remove functions from ORDER BY if its argument is also in ORDER BY

<h2 id="optimize_respect_aliases">
  optimize\_respect\_aliases
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

If it is set to true, it will respect aliases in WHERE/GROUP BY/ORDER BY, that will help with partition pruning/secondary indexes/optimize\_aggregation\_in\_order/optimize\_read\_in\_order/optimize\_trivial\_count

<h2 id="optimize_rewrite_aggregate_function_with_if">
  optimize\_rewrite\_aggregate\_function\_with\_if
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Rewrite aggregate functions with if expression as argument when logically equivalent.
For example, `avg(if(cond, col, null))` can be rewritten to `avgOrNullIf(cond, col)`. It may improve performance.

<Note>
  Supported only with the analyzer (`enable_analyzer = 1`).
</Note>

<h2 id="optimize_rewrite_array_exists_to_has">
  optimize\_rewrite\_array\_exists\_to\_has
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1"},{"label": "Enable arrayExists to has rewrite optimization by default, now that type compatibility is checked before rewriting."}]}]} />

Rewrite arrayExists() functions to has() when logically equivalent. For example, arrayExists(x -> x = 1, arr) can be rewritten to has(arr, 1)

<h2 id="optimize_rewrite_has_to_in">
  optimize\_rewrite\_has\_to\_in
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1"},{"label": "New setting"}]}]} />

Rewrite `has` functions to `IN` when the first argument is a constant array. For example, `has([1, 2, 3], x)` can be rewritten to `x IN [1, 2, 3]` for better performance with constant arrays

<h2 id="optimize_rewrite_like_perfect_affix">
  optimize\_rewrite\_like\_perfect\_affix
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "1"},{"label": "New setting"}]}]} />

Rewrite LIKE expressions with perfect prefix or suffix (e.g. `col LIKE 'ClickHouse%'`) to startsWith or endsWith functions (e.g. `startsWith(col, 'ClickHouse')`).

<h2 id="optimize_rewrite_regexp_functions">
  optimize\_rewrite\_regexp\_functions
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "A new setting"}]}]} />

Rewrite regular expression related functions into simpler and more efficient forms

<h2 id="optimize_rewrite_sum_if_to_count_if">
  optimize\_rewrite\_sum\_if\_to\_count\_if
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "1"},{"label": "Only available for the analyzer, where it works correctly"}]}]} />

Rewrite sumIf() and sum(if()) function countIf() function when logically equivalent

<h2 id="optimize_skip_merged_partitions">
  optimize\_skip\_merged\_partitions
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables or disables optimization for [OPTIMIZE TABLE ... FINAL](/reference/statements/optimize) query if there is only one part with level > 0 and it doesn't have expired TTL.

* `OPTIMIZE TABLE ... FINAL SETTINGS optimize_skip_merged_partitions=1`

By default, `OPTIMIZE TABLE ... FINAL` query rewrites the one part even if there is only a single part.

Possible values:

* 1 - Enable optimization.
* 0 - Disable optimization.

<h2 id="optimize_skip_unused_shards">
  optimize\_skip\_unused\_shards
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables or disables skipping of unused shards for [SELECT](/reference/statements/select/index) queries that have sharding key condition in `WHERE/PREWHERE`, and activates related optimizations for distributed queries (e.g. aggregation by sharding key).

<Note>
  Assumes that the data is distributed by sharding key, otherwise a query yields incorrect result.
</Note>

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="optimize_skip_unused_shards_limit">
  optimize\_skip\_unused\_shards\_limit
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000" />

Limit for number of sharding key values, turns off `optimize_skip_unused_shards` if the limit is reached.

Too many values may require significant amount for processing, while the benefit is doubtful, since if you have huge number of values in `IN (...)`, then most likely the query will be sent to all shards anyway.

<h2 id="optimize_skip_unused_shards_nesting">
  optimize\_skip\_unused\_shards\_nesting
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Controls [`optimize_skip_unused_shards`](#optimize_skip_unused_shards) (hence still requires [`optimize_skip_unused_shards`](#optimize_skip_unused_shards)) depends on the nesting level of the distributed query (case when you have `Distributed` table that look into another `Distributed` table).

Possible values:

* 0 — Disabled, `optimize_skip_unused_shards` works always.
* 1 — Enables `optimize_skip_unused_shards` only for the first level.
* 2 — Enables `optimize_skip_unused_shards` up to the second level.

<h2 id="optimize_skip_unused_shards_rewrite_in">
  optimize\_skip\_unused\_shards\_rewrite\_in
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Rewrite IN in query for remote shards to exclude values that does not belong to the shard (requires optimize\_skip\_unused\_shards).

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="optimize_sorting_by_input_stream_properties">
  optimize\_sorting\_by\_input\_stream\_properties
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Optimize sorting by sorting properties of input stream

<h2 id="optimize_substitute_columns">
  optimize\_substitute\_columns
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Use [constraints](/reference/statements/create/table#constraints) for column substitution. The default is `false`.

Possible values:

* true, false

<h2 id="optimize_syntax_fuse_functions">
  optimize\_syntax\_fuse\_functions
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "1"},{"label": "The optimization is production-ready"}]}]} />

Enables to fuse aggregate functions with identical argument. It rewrites query contains at least two aggregate functions from [sum](/reference/functions/aggregate-functions/sum), [count](/reference/functions/aggregate-functions/count) or [avg](/reference/functions/aggregate-functions/avg) with identical argument to [sumCount](/reference/functions/aggregate-functions/sumCount).

Possible values:

* 0 — Functions with identical argument are not fused.
* 1 — Functions with identical argument are fused.

**Example**

Query:

```sql theme={null}
CREATE TABLE fuse_tbl(a Int8, b Int8) Engine = Log;
SET optimize_syntax_fuse_functions = 1;
EXPLAIN SYNTAX run_query_tree_passes = 1 SELECT sum(a), sum(b), count(b), avg(b) from fuse_tbl FORMAT TSV;
```

Result:

```text theme={null}
SELECT
    sum(__table1.a) AS `sum(a)`,
    tupleElement(sumCount(__table1.b), 1) AS `sum(b)`,
    tupleElement(sumCount(__table1.b), 2) AS `count(b)`,
    divide(tupleElement(sumCount(__table1.b), 1), toFloat64(tupleElement(sumCount(__table1.b), 2))) AS `avg(b)`
FROM default.fuse_tbl AS __table1
```

<h2 id="optimize_throw_if_noop">
  optimize\_throw\_if\_noop
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables or disables throwing an exception if an [OPTIMIZE](/reference/statements/optimize) query didn't perform a merge.

By default, `OPTIMIZE` returns successfully even if it didn't do anything. This setting lets you differentiate these situations and get the reason in an exception message.

Possible values:

* 1 — Throwing an exception is enabled.
* 0 — Throwing an exception is disabled.

<h2 id="optimize_time_filter_with_preimage">
  optimize\_time\_filter\_with\_preimage
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "1"},{"label": "Optimize Date and DateTime predicates by converting functions into equivalent comparisons without conversions (e.g. toYear(col) = 2023 -> col >= '2023-01-01' AND col <= '2023-12-31')"}]}]} />

Optimize Date and DateTime predicates by converting functions into equivalent comparisons without conversions (e.g. `toYear(col) = 2023 -> col >= '2023-01-01' AND col <= '2023-12-31'`)

<h2 id="optimize_trivial_approximate_count_query">
  optimize\_trivial\_approximate\_count\_query
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Use an approximate value for trivial count optimization of storages that support such estimation, for example, EmbeddedRocksDB.

Possible values:

* 0 — Optimization disabled.
* 1 — Optimization enabled.

<h2 id="optimize_trivial_count_query">
  optimize\_trivial\_count\_query
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enables or disables the optimization to trivial query `SELECT count() FROM table` using metadata from MergeTree. If you need to use row-level security, disable this setting.

Possible values:

* 0 — Optimization disabled.
* 1 — Optimization enabled.

See also:

* [optimize\_functions\_to\_subcolumns](#optimize_functions_to_subcolumns)

<h2 id="optimize_trivial_group_by_limit_query">
  optimize\_trivial\_group\_by\_limit\_query
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1"},{"label": "New setting that limits aggregation to at most LIMIT distinct keys for `SELECT key_expr FROM t GROUP BY key_expr LIMIT n` queries."}]}]} />

Enables or disables the optimization of a trivial query `SELECT key_expr FROM table GROUP BY key_expr LIMIT n` (with no aggregate functions in the projection, no `HAVING`/`ORDER BY`/`LIMIT BY`/window clauses, and no `GROUP BY` modifiers) by setting `max_rows_to_group_by = n + offset` with `group_by_overflow_mode = 'any'`. The aggregation stops once `n + offset` distinct keys are produced.

The optimization is suppressed when the user has explicitly set `group_by_overflow_mode` to a non-`any` value (to preserve their explicit `throw`/`break` contract), and when the user has already set a tighter `max_rows_to_group_by` (the optimization would be a no-op).

Possible values:

* 0 — Optimization disabled.
* 1 — Optimization enabled.

<h2 id="optimize_trivial_insert_select">
  optimize\_trivial\_insert\_select
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "0"},{"label": "The optimization does not make sense in many cases."}]}]} />

Optimize trivial 'INSERT INTO table SELECT ... FROM TABLES' query

<h2 id="optimize_truncate_order_by_after_group_by_keys">
  optimize\_truncate\_order\_by\_after\_group\_by\_keys
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1"},{"label": "Remove trailing ORDER BY elements once all GROUP BY keys are covered in the ORDER BY prefix."}]}]} />

Remove trailing ORDER BY elements once all GROUP BY keys are covered in the ORDER BY prefix.

<h2 id="optimize_uniq_to_count">
  optimize\_uniq\_to\_count
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Rewrite uniq and its variants(except uniqUpTo) to count if subquery has distinct or group by clause.

<h2 id="optimize_use_implicit_projections">
  optimize\_use\_implicit\_projections
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Automatically choose implicit projections to perform SELECT query

<h2 id="optimize_use_projection_filtering">
  optimize\_use\_projection\_filtering
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "1"},{"label": "New setting"}]}]} />

Enables using projections to filter part ranges even when projections are not selected to perform SELECT query.

<h2 id="optimize_use_projections">
  optimize\_use\_projections
</h2>

**Aliases**: `allow_experimental_projection_optimization`

<SettingsInfoBlock type="Bool" default_value="1" />

Enables or disables [projection](/reference/engines/table-engines/mergetree-family/mergetree#projections) optimization when processing `SELECT` queries.

Possible values:

* 0 — Projection optimization disabled.
* 1 — Projection optimization enabled.

<h2 id="optimize_using_constraints">
  optimize\_using\_constraints
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Use [constraints](/reference/statements/create/table#constraints) for query optimization. The default is `false`.

Possible values:

* true, false

<h2 id="os_threads_nice_value_materialized_view">
  os\_threads\_nice\_value\_materialized\_view
</h2>

<SettingsInfoBlock type="Int32" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "0"},{"label": "New setting."}]}]} />

Linux nice value for materialized view threads. Lower values mean higher CPU priority.

Requires CAP\_SYS\_NICE capability, otherwise no-op.

Possible values: -20 to 19.

<h2 id="os_threads_nice_value_query">
  os\_threads\_nice\_value\_query
</h2>

**Aliases**: `os_thread_priority`

<SettingsInfoBlock type="Int32" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "0"},{"label": "New setting."}]}]} />

Linux nice value for query processing threads. Lower values mean higher CPU priority.

Requires CAP\_SYS\_NICE capability, otherwise no-op.

Possible values: -20 to 19.

<h2 id="page_cache_block_size">
  page\_cache\_block\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="1048576" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "1048576"},{"label": "Made this setting adjustable on a per-query level."}]}]} />

Size of file chunks to store in the userspace page cache, in bytes. All reads that go through the cache will be rounded up to a multiple of this size.

This setting can be adjusted on a per-query level basis, but cache entries with different block sizes cannot be reused. Changing this setting effectively invalidates existing entries in the cache.

A higher value, like 1 MiB is good for high-throughput queries, and a lower value, like 64 KiB is good for low-latency point queries.

<h2 id="page_cache_inject_eviction">
  page\_cache\_inject\_eviction
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "Added userspace page cache"}]}]} />

Userspace page cache will sometimes invalidate some pages at random. Intended for testing.

<h2 id="page_cache_lookahead_blocks">
  page\_cache\_lookahead\_blocks
</h2>

<SettingsInfoBlock type="UInt64" default_value="16" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "16"},{"label": "Made this setting adjustable on a per-query level."}]}]} />

On userspace page cache miss, read up to this many consecutive blocks at once from the underlying storage, if they're also not in the cache. Each block is page\_cache\_block\_size bytes.

A higher value is good for high-throughput queries, while low-latency point queries will work better without readahead.

<h2 id="page_cache_max_coalesced_bytes">
  page\_cache\_max\_coalesced\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="16777216" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "16777216"},{"label": "New setting to bound the size of a single coalesced read used to populate the userspace page cache on cache miss."}]}]} />

When `readBigAt` populates the userspace page cache, consecutive cache misses are coalesced into a single read from the underlying storage. This setting bounds the size of one coalesced read in bytes; longer miss runs are split into multiple reads. It limits transient memory usage of the temporary buffer under parallel cold reads.

A higher value reduces the number of HTTP requests for cold scans on object storage; a lower value reduces peak transient memory.

<h2 id="paimon_target_snapshot_id">
  paimon\_target\_snapshot\_id
</h2>

<SettingsInfoBlock type="Int64" default_value="-1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "-1"},{"label": "New setting."}]}]} />

Query-level targeted snapshot read for Paimon incremental mode. When >0, the reader will only fetch the delta
for the specified snapshot\_id without advancing the committed watermark.
Default: -1 (disabled)

<h2 id="parallel_distributed_insert_select">
  parallel\_distributed\_insert\_select
</h2>

<SettingsInfoBlock type="UInt64" default_value="2" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "2"},{"label": "Enable parallel distributed insert select by default"}]}]} />

Enables parallel distributed `INSERT ... SELECT` query.

If we execute `INSERT INTO distributed_table_a SELECT ... FROM distributed_table_b` queries and both tables use the same cluster, and both tables are either [replicated](/reference/engines/table-engines/mergetree-family/replication) or non-replicated, then this query is processed locally on every shard.

Possible values:

* `0` — Disabled.
* `1` — `SELECT` will be executed on each shard from the underlying table of the distributed engine.
* `2` — `SELECT` and `INSERT` will be executed on each shard from/to the underlying table of the distributed engine.

Since v25.4, `INSERT ... SELECT` from a `ReplicatedMergeTree` or `SharedMergeTree` source can also be parallelized across replicas. To enable it:

* `parallel_distributed_insert_select = 2`
* `enable_parallel_replicas = 1`

<h2 id="parallel_hash_join_threshold">
  parallel\_hash\_join\_threshold
</h2>

<SettingsInfoBlock type="UInt64" default_value="100000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "100000"},{"label": "New setting"}]}, {"id": "row-2","items": [{"label": "25.4"},{"label": "0"},{"label": "New setting"}]}, {"id": "row-3","items": [{"label": "25.3"},{"label": "0"},{"label": "New setting"}]}]} />

When hash-based join algorithm is applied, this threshold helps to decide between using `hash` and `parallel_hash` (only if estimation of the right table size is available).
The former is used when we know that the right table size is below the threshold.

<h2 id="parallel_non_joined_rows_processing">
  parallel\_non\_joined\_rows\_processing
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "New setting to enable parallel processing of non-joined rows in RIGHT/FULL parallel_hash joins."}]}]} />

Allow multiple threads to process non-joined rows from the right table in parallel during RIGHT and FULL JOINs.
This can speed up the non-joined phase when using the `parallel_hash` join algorithm with large tables.
When disabled, non-joined rows are processed by a single thread.

<h2 id="parallel_replica_offset">
  parallel\_replica\_offset
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

This is internal setting that should not be used directly and represents an implementation detail of the 'parallel replicas' mode. This setting will be automatically set up by the initiator server for distributed queries to the index of the replica participating in query processing among parallel replicas.

<h2 id="parallel_replicas_allow_in_with_subquery">
  parallel\_replicas\_allow\_in\_with\_subquery
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1"},{"label": "If true, subquery for IN will be executed on every follower replica"}]}]} />

If true, subquery for IN will be executed on every follower replica.

<h2 id="parallel_replicas_allow_materialized_views">
  parallel\_replicas\_allow\_materialized\_views
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "1"},{"label": "Allow usage of materialized views with parallel replicas"}]}]} />

Allow usage of materialized views with parallel replicas

<h2 id="parallel_replicas_allow_view_over_mergetree">
  parallel\_replicas\_allow\_view\_over\_mergetree
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "New setting"}]}]} />

Allow parallel replicas to execute the outer query of a simple view over `MergeTree` tables (instead of the view's inner query), improving parallelization across nodes. Also applies to `UNION ALL` views whose branches all read from different `MergeTree` tables.

<h2 id="parallel_replicas_connect_timeout_ms">
  parallel\_replicas\_connect\_timeout\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="300" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "300"},{"label": "Separate connection timeout for parallel replicas queries"}]}]} />

The timeout in milliseconds for connecting to a remote replica during query execution with parallel replicas. If the timeout is expired, the corresponding replicas is not used for query executio

<h2 id="parallel_replicas_count">
  parallel\_replicas\_count
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

This is internal setting that should not be used directly and represents an implementation detail of the 'parallel replicas' mode. This setting will be automatically set up by the initiator server for distributed queries to the number of parallel replicas participating in query processing.

<h2 id="parallel_replicas_custom_key">
  parallel\_replicas\_custom\_key
</h2>

An arbitrary integer expression that can be used to split work between replicas for a specific table.
The value can be any integer expression.

Simple expressions using primary keys are preferred.

If the setting is used on a cluster that consists of a single shard with multiple replicas, those replicas will be converted into virtual shards.
Otherwise, it will behave same as for `SAMPLE` key, it will use multiple replicas of each shard.

<h2 id="parallel_replicas_custom_key_range_lower">
  parallel\_replicas\_custom\_key\_range\_lower
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "Add settings to control the range filter when using parallel replicas with dynamic shards"}]}]} />

Allows the filter type `range` to split the work evenly between replicas based on the custom range `[parallel_replicas_custom_key_range_lower, INT_MAX]`.

When used in conjunction with [parallel\_replicas\_custom\_key\_range\_upper](#parallel_replicas_custom_key_range_upper), it lets the filter evenly split the work over replicas for the range `[parallel_replicas_custom_key_range_lower, parallel_replicas_custom_key_range_upper]`.

Note: This setting will not cause any additional data to be filtered during query processing, rather it changes the points at which the range filter breaks up the range `[0, INT_MAX]` for parallel processing.

<h2 id="parallel_replicas_custom_key_range_upper">
  parallel\_replicas\_custom\_key\_range\_upper
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "Add settings to control the range filter when using parallel replicas with dynamic shards. A value of 0 disables the upper limit"}]}]} />

Allows the filter type `range` to split the work evenly between replicas based on the custom range `[0, parallel_replicas_custom_key_range_upper]`. A value of 0 disables the upper bound, setting it the max value of the custom key expression.

When used in conjunction with [parallel\_replicas\_custom\_key\_range\_lower](#parallel_replicas_custom_key_range_lower), it lets the filter evenly split the work over replicas for the range `[parallel_replicas_custom_key_range_lower, parallel_replicas_custom_key_range_upper]`.

Note: This setting will not cause any additional data to be filtered during query processing, rather it changes the points at which the range filter breaks up the range `[0, INT_MAX]` for parallel processing

<h2 id="parallel_replicas_filter_pushdown">
  parallel\_replicas\_filter\_pushdown
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "New setting"}]}]} />

Allow pushing down filters to part of query which parallel replicas choose to execute

<h2 id="parallel_replicas_for_cluster_engines">
  parallel\_replicas\_for\_cluster\_engines
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.3"},{"label": "1"},{"label": "New setting."}]}]} />

Replace table function engines with their -Cluster alternatives

<h2 id="parallel_replicas_for_non_replicated_merge_tree">
  parallel\_replicas\_for\_non\_replicated\_merge\_tree
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

If true, ClickHouse will use parallel replicas algorithm also for non-replicated MergeTree tables

<h2 id="parallel_replicas_index_analysis_only_on_coordinator">
  parallel\_replicas\_index\_analysis\_only\_on\_coordinator
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.12"},{"label": "1"},{"label": "Index analysis done only on replica-coordinator and skipped on other replicas. Effective only with enabled parallel_replicas_local_plan"}]}, {"id": "row-2","items": [{"label": "24.10"},{"label": "1"},{"label": "Index analysis done only on replica-coordinator and skipped on other replicas. Effective only with enabled parallel_replicas_local_plan"}]}]} />

Index analysis done only on replica-coordinator and skipped on other replicas. Effective only with enabled parallel\_replicas\_local\_pla

<h2 id="parallel_replicas_insert_select_local_pipeline">
  parallel\_replicas\_insert\_select\_local\_pipeline
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "1"},{"label": "Use local pipeline during distributed INSERT SELECT with parallel replicas. Currently disabled due to performance issues"}]}, {"id": "row-2","items": [{"label": "25.4"},{"label": "0"},{"label": "Use local pipeline during distributed INSERT SELECT with parallel replicas. Currently disabled due to performance issues"}]}]} />

Use local pipeline during distributed INSERT SELECT with parallel replicas

<h2 id="parallel_replicas_local_plan">
  parallel\_replicas\_local\_plan
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "0"},{"label": "Use local plan for local replica in a query with parallel replicas"}]}, {"id": "row-2","items": [{"label": "24.11"},{"label": "1"},{"label": "Use local plan for local replica in a query with parallel replicas"}]}, {"id": "row-3","items": [{"label": "24.10"},{"label": "1"},{"label": "Use local plan for local replica in a query with parallel replicas"}]}]} />

Build local plan for local replica

<h2 id="parallel_replicas_mark_segment_size">
  parallel\_replicas\_mark\_segment\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.9"},{"label": "0"},{"label": "Value for this setting now determined automatically"}]}, {"id": "row-2","items": [{"label": "24.1"},{"label": "128"},{"label": "Add new setting to control segment size in new parallel replicas coordinator implementation"}]}]} />

Parts virtually divided into segments to be distributed between replicas for parallel reading. This setting controls the size of these segments. Not recommended to change until you're absolutely sure in what you're doing. Value should be in range \[128; 16384]

<h2 id="parallel_replicas_min_number_of_rows_per_replica">
  parallel\_replicas\_min\_number\_of\_rows\_per\_replica
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Limit the number of replicas used in a query to (estimated rows to read / min\_number\_of\_rows\_per\_replica). The max is still limited by 'max\_parallel\_replicas'

<h2 id="parallel_replicas_mode">
  parallel\_replicas\_mode
</h2>

<SettingsInfoBlock type="ParallelReplicasMode" default_value="read_tasks" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "read_tasks"},{"label": "This setting was introduced as a part of making parallel replicas feature Beta"}]}]} />

Type of filter to use with custom key for parallel replicas. default - use modulo operation on the custom key, range - use range filter on custom key using all possible values for the value type of custom key.

<h2 id="parallel_replicas_only_with_analyzer">
  parallel\_replicas\_only\_with\_analyzer
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "1"},{"label": "Parallel replicas is supported only with analyzer enabled"}]}]} />

The analyzer should be enabled to use parallel replicas. With disabled analyzer query execution fallbacks to local execution, even if parallel reading from replicas is enabled. Using parallel replicas without the analyzer enabled is not supported

<h2 id="parallel_replicas_prefer_local_join">
  parallel\_replicas\_prefer\_local\_join
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "1"},{"label": "If true, and JOIN can be executed with parallel replicas algorithm, and all storages of right JOIN part are *MergeTree, local JOIN will be used instead of GLOBAL JOIN."}]}]} />

If true, and JOIN can be executed with parallel replicas algorithm, and all storages of right JOIN part are \*MergeTree, local JOIN will be used instead of GLOBAL JOIN.

<h2 id="parallel_replicas_prefer_local_replica">
  parallel\_replicas\_prefer\_local\_replica
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1"},{"label": "New setting. When disabled, replicas for parallel reading are selected purely by the load balancing algorithm without forcing the local replica into the set."}]}]} />

When enabled (default), the local replica is always included in the set of replicas used for parallel reading.
When disabled, the local replica is not given any preference and replicas are selected purely by the load balancing algorithm.
This allows queries with `max_parallel_replicas = 1` to be directed to another host, which can improve cache locality when many short queries are distributed across a cluster.

<h2 id="parallel_replicas_support_projection">
  parallel\_replicas\_support\_projection
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "New setting. Optimization of projections can be applied in parallel replicas. Effective only with enabled parallel_replicas_local_plan and aggregation_in_order is inactive."}]}]} />

Optimization of projections can be applied in parallel replicas. Effective only with enabled parallel\_replicas\_local\_plan and aggregation\_in\_order is inactive.

<h2 id="parallel_view_processing">
  parallel\_view\_processing
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables pushing to attached views concurrently instead of sequentially.

<h2 id="parallelize_output_from_storages">
  parallelize\_output\_from\_storages
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.5"},{"label": "1"},{"label": "Allow parallelism when executing queries that read from file/url/s3/etc. This may reorder rows."}]}]} />

Parallelize output for reading step from storage. It allows parallelization of query processing right after reading from storage if possible

<h2 id="parsedatetime_e_requires_space_padding">
  parsedatetime\_e\_requires\_space\_padding
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "0"},{"label": "Improved compatibility with MySQL DATE_FORMAT/STR_TO_DATE"}]}]} />

Formatter '%e' in function 'parseDateTime' expects that single-digit days are space-padded, e.g., ' 2' is accepted but '2' raises an error.

<h2 id="parsedatetime_parse_without_leading_zeros">
  parsedatetime\_parse\_without\_leading\_zeros
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.11"},{"label": "1"},{"label": "Improved compatibility with MySQL DATE_FORMAT/STR_TO_DATE"}]}]} />

Formatters '%c', '%l' and '%k' in function 'parseDateTime' parse months and hours without leading zeros.

<h2 id="partial_merge_join_left_table_buffer_bytes">
  partial\_merge\_join\_left\_table\_buffer\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

If not 0 group left table blocks in bigger ones for left-side table in partial merge join. It uses up to 2x of specified memory per joining thread.

<h2 id="partial_merge_join_rows_in_right_blocks">
  partial\_merge\_join\_rows\_in\_right\_blocks
</h2>

<SettingsInfoBlock type="UInt64" default_value="65536" />

Limits sizes of right-hand join data blocks in partial merge join algorithm for [JOIN](/reference/statements/select/join) queries.

ClickHouse server:

1. Splits right-hand join data into blocks with up to the specified number of rows.
2. Indexes each block with its minimum and maximum values.
3. Unloads prepared blocks to disk if it is possible.

Possible values:

* Any positive integer. Recommended range of values: \[1000, 100000].

<h2 id="partial_result_on_first_cancel">
  partial\_result\_on\_first\_cancel
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Allows query to return a partial result after cancel.

<h2 id="parts_to_delay_insert">
  parts\_to\_delay\_insert
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

If the destination table contains at least that many active parts in a single partition, artificially slow down insert into table.

<h2 id="parts_to_throw_insert">
  parts\_to\_throw\_insert
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

If more than this number active parts in a single partition of the destination table, throw 'Too many parts ...' exception.

<h2 id="per_part_index_stats">
  per\_part\_index\_stats
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "0"},{"label": "New setting."}]}]} />

Logs index statistics per part

<h2 id="poll_interval">
  poll\_interval
</h2>

<SettingsInfoBlock type="UInt64" default_value="10" />

Block at the query wait loop on the server for the specified number of seconds.

<h2 id="polyglot_dialect">
  polyglot\_dialect
</h2>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": ""},{"label": "New setting to specify the source SQL dialect for the polyglot transpiler."}]}]} />

Source SQL dialect for the polyglot transpiler (e.g. 'sqlite', 'mysql', 'postgresql', 'snowflake', 'duckdb').

<h2 id="postgresql_connection_attempt_timeout">
  postgresql\_connection\_attempt\_timeout
</h2>

<SettingsInfoBlock type="UInt64" default_value="2" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "2"},{"label": "Allow to control 'connect_timeout' parameter of PostgreSQL connection."}]}]} />

Connection timeout in seconds of a single attempt to connect PostgreSQL end-point.
The value is passed as a `connect_timeout` parameter of the connection URL.

<h2 id="postgresql_connection_pool_auto_close_connection">
  postgresql\_connection\_pool\_auto\_close\_connection
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Close connection before returning connection to the pool.

<h2 id="postgresql_connection_pool_retries">
  postgresql\_connection\_pool\_retries
</h2>

<SettingsInfoBlock type="UInt64" default_value="2" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "2"},{"label": "Allow to control the number of retries in PostgreSQL connection pool."}]}]} />

Connection pool push/pop retries number for PostgreSQL table engine and database engine.

<h2 id="postgresql_connection_pool_size">
  postgresql\_connection\_pool\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="16" />

Connection pool size for PostgreSQL table engine and database engine.

<h2 id="postgresql_connection_pool_wait_timeout">
  postgresql\_connection\_pool\_wait\_timeout
</h2>

<SettingsInfoBlock type="UInt64" default_value="5000" />

Connection pool push/pop timeout on empty pool for PostgreSQL table engine and database engine. By default it will block on empty pool.

<h2 id="postgresql_fault_injection_probability">
  postgresql\_fault\_injection\_probability
</h2>

<SettingsInfoBlock type="Float" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "0"},{"label": "New setting"}]}]} />

Approximate probability of failing internal (for replication) PostgreSQL queries. Valid value is in interval \[0.0f, 1.0f]

<h2 id="predicate_statistics_sample_rate">
  predicate\_statistics\_sample\_rate
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting to collect predicate selectivity statistics into system.predicate_statistics_log"}]}]} />

Collect predicate selectivity statistics into `system.predicate_statistics_log`. When set to N > 0, approximately 1/N of queries are sampled (by the query ID). 0 means disabled.

<h2 id="prefer_column_name_to_alias">
  prefer\_column\_name\_to\_alias
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables or disables using the original column names instead of aliases in query expressions and clauses. It especially matters when alias is the same as the column name, see [Expression Aliases](/reference/syntax#notes-on-usage). Enable this setting to make aliases syntax rules in ClickHouse more compatible with most other database engines.

Possible values:

* 0 — The column name is substituted with the alias.
* 1 — The column name is not substituted with the alias.

**Example**

The difference between enabled and disabled:

Query:

```sql theme={null}
SET prefer_column_name_to_alias = 0;
SELECT avg(number) AS number, max(number) FROM numbers(10);
```

Result:

```text theme={null}
Received exception from server (version 21.5.1):
Code: 184. DB::Exception: Received from localhost:9000. DB::Exception: Aggregate function avg(number) is found inside another aggregate function in query: While processing avg(number) AS number.
```

Query:

```sql theme={null}
SET prefer_column_name_to_alias = 1;
SELECT avg(number) AS number, max(number) FROM numbers(10);
```

Result:

```text theme={null}
┌─number─┬─max(number)─┐
│    4.5 │           9 │
└────────┴─────────────┘
```

<h2 id="prefer_external_sort_block_bytes">
  prefer\_external\_sort\_block\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="16744704" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.5"},{"label": "16744704"},{"label": "Prefer maximum block bytes for external sort, reduce the memory usage during merging."}]}]} />

Prefer maximum block bytes for external sort, reduce the memory usage during merging.

<h2 id="prefer_global_in_and_join">
  prefer\_global\_in\_and\_join
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables the replacement of `IN`/`JOIN` operators with `GLOBAL IN`/`GLOBAL JOIN`.

Possible values:

* 0 — Disabled. `IN`/`JOIN` operators are not replaced with `GLOBAL IN`/`GLOBAL JOIN`.
* 1 — Enabled. `IN`/`JOIN` operators are replaced with `GLOBAL IN`/`GLOBAL JOIN`.

**Usage**

Although `SET distributed_product_mode=global` can change the queries behavior for the distributed tables, it's not suitable for local tables or tables from external resources. Here is when the `prefer_global_in_and_join` setting comes into play.

For example, we have query serving nodes that contain local tables, which are not suitable for distribution. We need to scatter their data on the fly during distributed processing with the `GLOBAL` keyword — `GLOBAL IN`/`GLOBAL JOIN`.

Another use case of `prefer_global_in_and_join` is accessing tables created by external engines. This setting helps to reduce the number of calls to external sources while joining such tables: only one call per query.

**See also:**

* [Distributed subqueries](/reference/statements/in#distributed-subqueries) for more information on how to use `GLOBAL IN`/`GLOBAL JOIN`

<h2 id="prefer_localhost_replica">
  prefer\_localhost\_replica
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enables/disables preferable using the localhost replica when processing distributed queries.

Possible values:

* 1 — ClickHouse always sends a query to the localhost replica if it exists.
* 0 — ClickHouse uses the balancing strategy specified by the [load\_balancing](#load_balancing) setting.

<Note>
  Disable this setting if you use [max\_parallel\_replicas](#max_parallel_replicas) without [parallel\_replicas\_custom\_key](#parallel_replicas_custom_key).
  If [parallel\_replicas\_custom\_key](#parallel_replicas_custom_key) is set, disable this setting only if it's used on a cluster with multiple shards containing multiple replicas.
  If it's used on a cluster with a single shard and multiple replicas, disabling this setting will have negative effects.
</Note>

<h2 id="prefer_warmed_unmerged_parts_seconds">
  prefer\_warmed\_unmerged\_parts\_seconds
</h2>

<SettingsInfoBlock type="Int64" default_value="0" />

Only has an effect in ClickHouse Cloud. If a merged part is less than this many seconds old and is not pre-warmed (see [cache\_populated\_by\_fetch](/reference/settings/merge-tree-settings#cache_populated_by_fetch)), but all its source parts are available and pre-warmed, SELECT queries will read from those parts instead. Only for Replicated-/SharedMergeTree. Note that this only checks whether CacheWarmer processed the part; if the part was fetched into cache by something else, it'll still be considered cold until CacheWarmer gets to it; if it was warmed, then evicted from cache, it'll still be considered warm.

<h2 id="preferred_block_size_bytes">
  preferred\_block\_size\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000000" />

This setting adjusts the data block size for query processing and represents additional fine-tuning to the more rough 'max\_block\_size' setting. If the columns are large and with 'max\_block\_size' rows the block size is likely to be larger than the specified amount of bytes, its size will be lowered for better CPU cache locality.

<h2 id="preferred_max_column_in_block_size_bytes">
  preferred\_max\_column\_in\_block\_size\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Limit on max column size in block while reading. Helps to decrease cache misses count. Should be close to L2 cache size.

<h2 id="preferred_optimize_projection_name">
  preferred\_optimize\_projection\_name
</h2>

If it is set to a non-empty string, ClickHouse will try to apply specified projection in query.

Possible values:

* string: name of preferred projectio

<h2 id="prefetch_buffer_size">
  prefetch\_buffer\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="1048576" />

The maximum size of the prefetch buffer to read from the filesystem.

<h2 id="print_pretty_type_names">
  print\_pretty\_type\_names
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.1"},{"label": "1"},{"label": "Better user experience."}]}]} />

Allows to print deep-nested type names in a pretty way with indents in `DESCRIBE` query and in `toTypeName()` function.

Example:

```sql theme={null}
CREATE TABLE test (a Tuple(b String, c Tuple(d Nullable(UInt64), e Array(UInt32), f Array(Tuple(g String, h Map(String, Array(Tuple(i String, j UInt64))))), k Date), l Nullable(String))) ENGINE=Memory;
DESCRIBE TABLE test FORMAT TSVRaw SETTINGS print_pretty_type_names=1;
```

```
a   Tuple(
    b String,
    c Tuple(
        d Nullable(UInt64),
        e Array(UInt32),
        f Array(Tuple(
            g String,
            h Map(
                String,
                Array(Tuple(
                    i String,
                    j UInt64
                ))
            )
        )),
        k Date
    ),
    l Nullable(String)
)
```

<h2 id="priority">
  priority
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Priority of the query. 1 - the highest, higher value - lower priority; 0 - do not use priorities.

<h2 id="promql_database">
  promql\_database
</h2>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": ""},{"label": "New experimental setting"}]}]} />

Specifies the database name used by the 'promql' dialect. Empty string means the current database.

<h2 id="promql_evaluation_time">
  promql\_evaluation\_time
</h2>

**Aliases**: `evaluation_time`

<SettingsInfoBlock type="FloatAuto" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "auto"},{"label": "The setting was renamed. The previous name is `evaluation_time`."}]}]} />

Sets the evaluation time to be used with promql dialect. 'auto' means the current time.

<h2 id="promql_table">
  promql\_table
</h2>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": ""},{"label": "New experimental setting"}]}]} />

Specifies the name of a TimeSeries table used by the 'promql' dialect.

<h2 id="push_external_roles_in_interserver_queries">
  push\_external\_roles\_in\_interserver\_queries
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "1"},{"label": "New setting."}]}]} />

Enable pushing user roles from originator to other nodes while performing a query.

<h2 id="query_cache_compress_entries">
  query\_cache\_compress\_entries
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Compress entries in the [query cache](/concepts/features/performance/caches/query-cache). Lessens the memory consumption of the query cache at the cost of slower inserts into / reads from it.

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="query_cache_for_subqueries">
  query\_cache\_for\_subqueries
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting to enable propagation of `use_query_cache` into all subqueries. Without it, subqueries are only cached on explicit per-subquery `SETTINGS use_query_cache = true` opt-in."}]}]} />

If turned on, subquery results may be written to and read from the [query cache](/concepts/features/performance/caches/query-cache). This enables propagation of `use_query_cache` into all subqueries.

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="query_cache_max_entries">
  query\_cache\_max\_entries
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The maximum number of query results the current user may store in the [query cache](/concepts/features/performance/caches/query-cache). 0 means unlimited.

Possible values:

* Positive integer >= 0.

<h2 id="query_cache_max_size_in_bytes">
  query\_cache\_max\_size\_in\_bytes
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The maximum amount of memory (in bytes) the current user may allocate in the [query cache](/concepts/features/performance/caches/query-cache). 0 means unlimited.

Possible values:

* Positive integer >= 0.

<h2 id="query_cache_min_query_duration">
  query\_cache\_min\_query\_duration
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="0" />

Minimum duration in milliseconds a query needs to run for its result to be stored in the [query cache](/concepts/features/performance/caches/query-cache).

Possible values:

* Positive integer >= 0.

<h2 id="query_cache_min_query_runs">
  query\_cache\_min\_query\_runs
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Minimum number of times a `SELECT` query must run before its result is stored in the [query cache](/concepts/features/performance/caches/query-cache).

Possible values:

* Positive integer >= 0.

<h2 id="query_cache_nondeterministic_function_handling">
  query\_cache\_nondeterministic\_function\_handling
</h2>

<SettingsInfoBlock type="QueryResultCacheNondeterministicFunctionHandling" default_value="throw" />

Controls how the [query cache](/concepts/features/performance/caches/query-cache) handles `SELECT` queries with non-deterministic functions like `rand()` or `now()`.

Possible values:

* `'throw'` - Throw an exception and don't cache the query result.
* `'save'` - Cache the query result.
* `'ignore'` - Don't cache the query result and don't throw an exception.

<h2 id="query_cache_share_between_users">
  query\_cache\_share\_between\_users
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

If turned on, the result of `SELECT` queries cached in the [query cache](/concepts/features/performance/caches/query-cache) can be read by other users.
It is not recommended to enable this setting due to security reasons.

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="query_cache_squash_partial_results">
  query\_cache\_squash\_partial\_results
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Squash partial result blocks to blocks of size [max\_block\_size](#max_block_size). Reduces performance of inserts into the [query cache](/concepts/features/performance/caches/query-cache) but improves the compressability of cache entries (see [query\_cache\_compress-entries](#query_cache_compress_entries)).

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="query_cache_system_table_handling">
  query\_cache\_system\_table\_handling
</h2>

<SettingsInfoBlock type="QueryResultCacheSystemTableHandling" default_value="throw" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "throw"},{"label": "The query cache no longer caches results of queries against system tables"}]}]} />

Controls how the [query cache](/concepts/features/performance/caches/query-cache) handles `SELECT` queries against system tables, i.e. tables in databases `system.*` and `information_schema.*`.

Possible values:

* `'throw'` - Throw an exception and don't cache the query result.
* `'save'` - Cache the query result.
* `'ignore'` - Don't cache the query result and don't throw an exception.

<h2 id="query_cache_tag">
  query\_cache\_tag
</h2>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": ""},{"label": "New setting for labeling query cache settings."}]}]} />

A string which acts as a label for [query cache](/concepts/features/performance/caches/query-cache) entries.
The same queries with different tags are considered different by the query cache.

Possible values:

* Any string

<h2 id="query_cache_ttl">
  query\_cache\_ttl
</h2>

<SettingsInfoBlock type="Seconds" default_value="60" />

After this time in seconds entries in the [query cache](/concepts/features/performance/caches/query-cache) become stale.

Possible values:

* Positive integer >= 0.

<h2 id="query_metric_log_interval">
  query\_metric\_log\_interval
</h2>

<SettingsInfoBlock type="Int64" default_value="-1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "-1"},{"label": "New setting."}]}]} />

The interval in milliseconds at which the [query\_metric\_log](/reference/system-tables/query_metric_log) for individual queries is collected.

If set to any negative value, it will take the value `collect_interval_milliseconds` from the [query\_metric\_log setting](/reference/settings/server-settings/settings#query_metric_log) or default to 1000 if not present.

To disable the collection of a single query, set `query_metric_log_interval` to 0.

Default value: -1

<h2 id="query_plan_aggregation_in_order">
  query\_plan\_aggregation\_in\_order
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.12"},{"label": "1"},{"label": "Enable some refactoring around query plan"}]}]} />

Toggles the aggregation in-order query-plan-level optimization.
Only takes effect if setting [`query_plan_enable_optimizations`](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_convert_any_join_to_semi_or_anti_join">
  query\_plan\_convert\_any\_join\_to\_semi\_or\_anti\_join
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "1"},{"label": "New setting."}]}]} />

Allow to convert ANY JOIN to SEMI or ANTI JOIN if filter after JOIN always evaluates to false for not-matched or matched rows

<h2 id="query_plan_convert_join_to_in">
  query\_plan\_convert\_join\_to\_in
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "0"},{"label": "New setting"}]}]} />

Allow to convert `JOIN` to subquery with `IN` if output columns tied to only left table. May cause wrong results with non-ANY JOINs (e.g. ALL JOINs which is the default).

<h2 id="query_plan_convert_outer_join_to_inner_join">
  query\_plan\_convert\_outer\_join\_to\_inner\_join
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "1"},{"label": "Allow to convert OUTER JOIN to INNER JOIN if filter after JOIN always filters default values"}]}]} />

Allow to convert `OUTER JOIN` to `INNER JOIN` if filter after `JOIN` always filters default values

<h2 id="query_plan_direct_read_from_text_index">
  query\_plan\_direct\_read\_from\_text\_index
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "The text index is now GA"}]}, {"id": "row-2","items": [{"label": "25.9"},{"label": "1"},{"label": "New setting."}]}]} />

Allow to perform full text search filtering using only the inverted text index in query plan.

<h2 id="query_plan_display_internal_aliases">
  query\_plan\_display\_internal\_aliases
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "0"},{"label": "New setting"}]}]} />

Show internal aliases (such as \_\_table1) in EXPLAIN PLAN instead of those specified in the original query.

<h2 id="query_plan_enable_multithreading_after_window_functions">
  query\_plan\_enable\_multithreading\_after\_window\_functions
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enable multithreading after evaluating window functions to allow parallel stream processing

<h2 id="query_plan_enable_optimizations">
  query\_plan\_enable\_optimizations
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Toggles query optimization at the query plan level.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable all optimizations at the query plan level
* 1 - Enable optimizations at the query plan level (but individual optimizations may still be disabled via their individual settings)

<h2 id="query_plan_execute_functions_after_sorting">
  query\_plan\_execute\_functions\_after\_sorting
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Toggles a query-plan-level optimization which moves expressions after sorting steps.
Only takes effect if setting [`query_plan_enable_optimizations`](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_filter_push_down">
  query\_plan\_filter\_push\_down
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Toggles a query-plan-level optimization which moves filters down in the execution plan.
Only takes effect if setting [query\_plan\_enable\_optimizations](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_join_shard_by_pk_ranges">
  query\_plan\_join\_shard\_by\_pk\_ranges
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "0"},{"label": "New setting"}]}]} />

Apply sharding for JOIN if join keys contain a prefix of PRIMARY KEY for both tables. Supported for hash, parallel\_hash and full\_sorting\_merge algorithms. Usually does not speed up queries but may lower memory consumption.

<h2 id="query_plan_join_swap_table">
  query\_plan\_join\_swap\_table
</h2>

<SettingsInfoBlock type="BoolAuto" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.12"},{"label": "auto"},{"label": "New setting. Right table was always chosen before."}]}]} />

Determine which side of the join should be the build table (also called inner, the one inserted into the hash table for a hash join) in the query plan. This setting is supported only for `ALL` join strictness with the `JOIN ON` clause. Possible values are:

* 'auto': Let the planner decide which table to use as the build table.
* 'false': Never swap tables (the right table is the build table).
* 'true': Always swap tables (the left table is the build table).

<h2 id="query_plan_lift_up_array_join">
  query\_plan\_lift\_up\_array\_join
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Toggles a query-plan-level optimization which moves ARRAY JOINs up in the execution plan.
Only takes effect if setting [query\_plan\_enable\_optimizations](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_lift_up_union">
  query\_plan\_lift\_up\_union
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Toggles a query-plan-level optimization which moves larger subtrees of the query plan into union to enable further optimizations.
Only takes effect if setting [`query_plan_enable_optimizations`](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_max_limit_for_join_lazy_indexing">
  query\_plan\_max\_limit\_for\_join\_lazy\_indexing
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1000"},{"label": "Added new setting to control maximum limit value that allows to use query plan for lazy join indexing optimization. If zero, there is no limit"}]}]} />

Control maximum limit value that allows to use query plan for lazy indexing optimization in JOIN. If zero, there is no limit.

<h2 id="query_plan_max_limit_for_lazy_materialization">
  query\_plan\_max\_limit\_for\_lazy\_materialization
</h2>

<SettingsInfoBlock type="UInt64" default_value="10000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "10"},{"label": "Added new setting to control maximum limit value that allows to use query plan for lazy materialization optimisation. If zero, there is no limit"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "10000"},{"label": "Increase the limit after performance improvement"}]}, {"id": "row-3","items": [{"label": "25.11"},{"label": "100"},{"label": "More optimal"}]}]} />

Control maximum limit value that allows to use query plan for lazy materialization optimization. If zero, there is no limit.

<h2 id="query_plan_max_limit_for_top_k_optimization">
  query\_plan\_max\_limit\_for\_top\_k\_optimization
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "1000"},{"label": "New setting."}]}]} />

Control maximum limit value that allows to evaluate query plan for TopK optimization by using minmax skip index and dynamic threshold filtering. If zero, there is no limit.

<h2 id="query_plan_max_optimizations_to_apply">
  query\_plan\_max\_optimizations\_to\_apply
</h2>

<SettingsInfoBlock type="UInt64" default_value="10000" />

Limits the total number of optimizations applied to query plan, see setting [query\_plan\_enable\_optimizations](#query_plan_enable_optimizations).
Useful to avoid long optimization times for complex queries.
In the EXPLAIN PLAN query, stop applying optimizations after this limit is reached and return the plan as is.
For regular query execution if the actual number of optimizations exceeds this setting, an exception is thrown.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

<h2 id="query_plan_max_set_size_for_projection_match">
  query\_plan\_max\_set\_size\_for\_projection\_match
</h2>

<SettingsInfoBlock type="UInt64" default_value="10000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "10000"},{"label": "Added new setting that bounds the cost of content-hashing IN-clause sets in the projection matcher (today: aggregate projection). Sets larger than the limit are treated as non-matching. Zero disables content-hash comparison entirely (compatibility value: projection match never succeeds for nodes with IN-sets)."}]}]} />

Maximum number of rows in an `IN`-clause set for which the projection matcher computes and compares content hashes when deciding whether two sets are equal. Sets larger than this are treated as non-matching and skip the projection. Zero disables content-hash comparison entirely: a projection match never succeeds for nodes containing `IN`-clause sets.

Used by the aggregate projection matcher (and any future projection matcher that needs to compare `IN`-clause sets). Computing the content hash is `O(N log N)` in the number of set elements; this setting bounds the cost paid during planning when many `IN`-clauses appear in the query or the projection.

<h2 id="query_plan_max_step_description_length">
  query\_plan\_max\_step\_description\_length
</h2>

<SettingsInfoBlock type="UInt64" default_value="500" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "500"},{"label": "New setting"}]}]} />

Maximum length of step description in EXPLAIN PLAN.

<h2 id="query_plan_merge_expressions">
  query\_plan\_merge\_expressions
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Toggles a query-plan-level optimization which merges consecutive filters.
Only takes effect if setting [query\_plan\_enable\_optimizations](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_merge_filter_into_join_condition">
  query\_plan\_merge\_filter\_into\_join\_condition
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "1"},{"label": "Added new setting to merge filter into join condition"}]}]} />

Allow to merge filter into `JOIN` condition and convert `CROSS JOIN` to `INNER`.

<h2 id="query_plan_merge_filters">
  query\_plan\_merge\_filters
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "0"},{"label": "Allow to merge filters in the query plan"}]}, {"id": "row-2","items": [{"label": "24.11"},{"label": "1"},{"label": "Allow to merge filters in the query plan. This is required to properly support filter-push-down with the analyzer."}]}]} />

Allow to merge filters in the query plan.

<h2 id="query_plan_min_columns_for_join_lazy_indexing">
  query\_plan\_min\_columns\_for\_join\_lazy\_indexing
</h2>

<SettingsInfoBlock type="UInt64" default_value="3" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "3"},{"label": "Control the minimum number of payload columns from the left side required for enabling lazy indexing optimization in JOIN"}]}]} />

Control the minimum number of payload columns from the left side required for enabling lazy indexing optimization in JOIN. 0 means the optimization is disabled.

<h2 id="query_plan_optimize_join_order_algorithm">
  query\_plan\_optimize\_join\_order\_algorithm
</h2>

<SettingsInfoBlock type="JoinOrderAlgorithm" default_value="greedy" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "greedy"},{"label": "New experimental setting."}]}]} />

Specifies which JOIN order algorithms to attempt during query plan optimization. The following algorithms are available:

* `greedy` - basic greedy algorithm - works fast but might not produce the best join order
* `dpsize` - implements DPsize algorithm currently only for inner joins - considers all possible join orders and finds the most optimal one but might be slow for queries with many tables and join predicates
* `dphyp` - implements DPhyp (Dynamic Programming via Hypergraph Partitioning) algorithm currently only for inner joins - explores the same search space as `dpsize` but enumerates only connected subgraph pairs, which generates fewer intermediate joins on sparse join graphs, at the cost of not considering cross products
  Multiple algorithms can be specified as a comma-separated list, e.g. `dphyp,greedy`. They are tried in order; if an algorithm cannot handle the query (e.g. due to outer joins or disconnected components), the next one is used as a fallback.

<h2 id="query_plan_optimize_join_order_limit">
  query\_plan\_optimize\_join\_order\_limit
</h2>

<SettingsInfoBlock type="UInt64" default_value="10" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "1"},{"label": "New setting"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "10"},{"label": "Allow JOIN reordering with more tables by default"}]}]} />

Optimize the order of joins within the same subquery. Currently only supported for very limited cases.
Value is the maximum number of tables to optimize.

<h2 id="query_plan_optimize_join_order_max_searched_plans">
  query\_plan\_optimize\_join\_order\_max\_searched\_plans
</h2>

<SettingsInfoBlock type="UInt64" default_value="100000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "100000"},{"label": "New setting to bound the number of partial plans the join order optimizer enumerates before falling back to the next algorithm."}]}]} />

Maximum number of partial plans the join order optimizer may enumerate before giving up and falling back to the next algorithm in `query_plan_optimize_join_order_algorithm`.
This bounds optimization time deterministically (independent of wall-clock) on dense join graphs such as cliques or stars, where the search space grows exponentially.
Set to 0 to disable the limit. Has no effect on the default `query_plan_optimize_join_order_limit`, where the search always stays well below this bound.

<h2 id="query_plan_optimize_join_order_randomize">
  query\_plan\_optimize\_join\_order\_randomize
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "New setting to randomize join order statistics for testing."}]}]} />

When non-zero, the join order optimizer uses randomly generated cardinalities and NDVs instead of real statistics.
When set to 1, a random seed is generated, when set to a value > 1, that value is used as the seed directly.
This is intended for testing to find errors caused by different join orderings.

<h2 id="query_plan_optimize_lazy_final">
  query\_plan\_optimize\_lazy\_final
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "New setting to optimize reading with FINAL from ReplacingMergeTree using set-based index analysis"}]}]} />

Optimize reading with FINAL from ReplacingMergeTree by building a set of primary keys and using it for index analysis.

<h2 id="query_plan_optimize_lazy_materialization">
  query\_plan\_optimize\_lazy\_materialization
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "1"},{"label": "Added new setting to use query plan for lazy materialization optimisation"}]}]} />

Use query plan for lazy materialization optimization.

<h2 id="query_plan_optimize_prewhere">
  query\_plan\_optimize\_prewhere
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "1"},{"label": "Allow to push down filter to PREWHERE expression for supported storages"}]}]} />

Allow to push down filter to PREWHERE expression for supported storages

<h2 id="query_plan_push_down_limit">
  query\_plan\_push\_down\_limit
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Toggles a query-plan-level optimization which moves LIMITs down in the execution plan.
Only takes effect if setting [query\_plan\_enable\_optimizations](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_push_limit_by_into_sort">
  query\_plan\_push\_limit\_by\_into\_sort
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1"},{"label": "New setting that pushes a per-stream LIMIT BY into the sort pipeline when LIMIT BY's columns are a prefix of ORDER BY, reducing rows flowing through the final merge."}]}]} />

Toggles a query-plan-level optimization for `ORDER BY ... LIMIT BY` queries. When `LIMIT BY` columns are a prefix of the `ORDER BY` clause, each parallel sorted stream applies `LIMIT BY` before the streams are merged into one, reducing rows processed by the final merge and later pipeline stages. Speeds up queries where `LIMIT BY` discards a large fraction of rows.

Only takes effect if setting [query\_plan\_enable\_optimizations](#query_plan_enable_optimizations) is 1.

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_read_in_order">
  query\_plan\_read\_in\_order
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Toggles the read in-order optimization query-plan-level optimization.
Only takes effect if setting [`query_plan_enable_optimizations`](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_read_in_order_through_join">
  query\_plan\_read\_in\_order\_through\_join
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "1"},{"label": "New setting"}]}]} />

Keep reading in order from the left table in JOIN operations, which can be utilized by subsequent steps.

<h2 id="query_plan_remove_redundant_distinct">
  query\_plan\_remove\_redundant\_distinct
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.2"},{"label": "1"},{"label": "Remove redundant Distinct step in query plan"}]}]} />

Toggles a query-plan-level optimization which removes redundant DISTINCT steps.
Only takes effect if setting [`query_plan_enable_optimizations`](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_remove_redundant_sorting">
  query\_plan\_remove\_redundant\_sorting
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.1"},{"label": "1"},{"label": "Remove redundant sorting in query plan. For example, sorting steps related to ORDER BY clauses in subqueries"}]}]} />

Toggles a query-plan-level optimization which removes redundant sorting steps, e.g. in subqueries.
Only takes effect if setting [`query_plan_enable_optimizations`](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_remove_unused_columns">
  query\_plan\_remove\_unused\_columns
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "1"},{"label": "New setting. Add optimization to remove unused columns in query plan."}]}]} />

Toggles a query-plan-level optimization which tries to remove unused columns (both input and output columns) from query plan steps.
Only takes effect if setting [query\_plan\_enable\_optimizations](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_reuse_storage_ordering_for_window_functions">
  query\_plan\_reuse\_storage\_ordering\_for\_window\_functions
</h2>

**Aliases**: `optimize_read_in_window_order`

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "0"},{"label": "Disable this logic by default."}]}]} />

Toggles a query-plan-level optimization which uses storage sorting when sorting for window functions.
Only takes effect if setting [`query_plan_enable_optimizations`](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_split_filter">
  query\_plan\_split\_filter
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Toggles a query-plan-level optimization which splits filters into expressions.
Only takes effect if setting [query\_plan\_enable\_optimizations](#query_plan_enable_optimizations) is 1.

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_text_index_add_hint">
  query\_plan\_text\_index\_add\_hint
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "1"},{"label": "New setting"}]}]} />

Allow to add hint (additional predicate) for filtering built from the inverted text index in query plan.

<h2 id="query_plan_top_k_through_join">
  query\_plan\_top\_k\_through\_join
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1"},{"label": "New setting to enable a query-plan-level optimization that pushes ORDER BY ... LIMIT n through a LEFT/RIGHT join when the sort key only references the preserved side."}]}]} />

Toggles a query-plan-level optimization which pushes `ORDER BY ... LIMIT n` down through a join when the sort key only references columns from the side preserved by the join (LEFT/RIGHT). Restricts how many rows the preserved-side input must produce before joining.
Only takes effect if setting [query\_plan\_enable\_optimizations](#query_plan_enable_optimizations) is 1.

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_plan_try_use_vector_search">
  query\_plan\_try\_use\_vector\_search
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "New setting."}]}]} />

Toggles a query-plan-level optimization which tries to use the vector similarity index.
Only takes effect if setting [`query_plan_enable_optimizations`](#query_plan_enable_optimizations) is 1.

<Note>
  This is an expert-level setting which should only be used for debugging by developers. The setting may change in future in backward-incompatible ways or be removed.
</Note>

Possible values:

* 0 - Disable
* 1 - Enable

<h2 id="query_profiler_cpu_time_period_ns">
  query\_profiler\_cpu\_time\_period\_ns
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000000000" />

Sets the period for a CPU clock timer of the [query profiler](/concepts/features/performance/troubleshoot/sampling-query-profiler). This timer counts only CPU time.

Possible values:

* A positive integer number of nanoseconds.

  Recommended values:

  * 10000000 (100 times a second) nanoseconds and more for single queries.
  * 1000000000 (once a second) for cluster-wide profiling.

* 0 for turning off the timer.

See also:

* System table [trace\_log](/reference/system-tables/trace_log)

<h2 id="query_profiler_real_time_period_ns">
  query\_profiler\_real\_time\_period\_ns
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000000000" />

Sets the period for a real clock timer of the [query profiler](/concepts/features/performance/troubleshoot/sampling-query-profiler). Real clock timer counts wall-clock time.

Possible values:

* Positive integer number, in nanoseconds.

  Recommended values:

  * 10000000 (100 times a second) nanoseconds and less for single queries.
  * 1000000000 (once a second) for cluster-wide profiling.

* 0 for turning off the timer.

See also:

* System table [trace\_log](/reference/system-tables/trace_log)

Cloud default value: `3000000000`.

<h2 id="queue_max_wait_ms">
  queue\_max\_wait\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="0" />

The wait time in the request queue, if the number of concurrent requests exceeds the maximum.

<h2 id="rabbitmq_max_wait_ms">
  rabbitmq\_max\_wait\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="5000" />

The wait time for reading from RabbitMQ before retry.

<h2 id="read_backoff_max_throughput">
  read\_backoff\_max\_throughput
</h2>

<SettingsInfoBlock type="UInt64" default_value="1048576" />

Settings to reduce the number of threads in case of slow reads. Count events when the read bandwidth is less than that many bytes per second.

<h2 id="read_backoff_min_concurrency">
  read\_backoff\_min\_concurrency
</h2>

<SettingsInfoBlock type="UInt64" default_value="1" />

Settings to try keeping the minimal number of threads in case of slow reads.

<h2 id="read_backoff_min_events">
  read\_backoff\_min\_events
</h2>

<SettingsInfoBlock type="UInt64" default_value="2" />

Settings to reduce the number of threads in case of slow reads. The number of events after which the number of threads will be reduced.

<h2 id="read_backoff_min_interval_between_events_ms">
  read\_backoff\_min\_interval\_between\_events\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="1000" />

Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time.

<h2 id="read_backoff_min_latency_ms">
  read\_backoff\_min\_latency\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="1000" />

Setting to reduce the number of threads in case of slow reads. Pay attention only to reads that took at least that much time.

<h2 id="read_from_distributed_cache_if_exists_otherwise_bypass_cache">
  read\_from\_distributed\_cache\_if\_exists\_otherwise\_bypass\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "0"},{"label": "New setting"}]}]} />

Only has an effect in ClickHouse Cloud. Same as read\_from\_filesystem\_cache\_if\_exists\_otherwise\_bypass\_cache, but for distributed cache.

<h2 id="read_from_filesystem_cache_if_exists_otherwise_bypass_cache">
  read\_from\_filesystem\_cache\_if\_exists\_otherwise\_bypass\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Allow to use the filesystem cache in passive mode - benefit from the existing cache entries, but don't put more entries into the cache. If you set this setting for heavy ad-hoc queries and leave it disabled for short real-time queries, this will allows to avoid cache threshing by too heavy queries and to improve the overall system efficiency.

<h2 id="read_from_page_cache_if_exists_otherwise_bypass_cache">
  read\_from\_page\_cache\_if\_exists\_otherwise\_bypass\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "Added userspace page cache"}]}]} />

Use userspace page cache in passive mode, similar to read\_from\_filesystem\_cache\_if\_exists\_otherwise\_bypass\_cache.

<h2 id="read_in_order_two_level_merge_threshold">
  read\_in\_order\_two\_level\_merge\_threshold
</h2>

<SettingsInfoBlock type="UInt64" default_value="100" />

Minimal number of parts to read to run preliminary merge step during multithread reading in order of primary key.

<h2 id="read_in_order_use_buffering">
  read\_in\_order\_use\_buffering
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.7"},{"label": "1"},{"label": "Use buffering before merging while reading in order of primary key"}]}]} />

Use buffering before merging while reading in order of primary key. It increases the parallelism of query executio

<h2 id="read_in_order_use_virtual_row">
  read\_in\_order\_use\_virtual\_row
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "0"},{"label": "Use virtual row while reading in order of primary key or its monotonic function fashion. It is useful when searching over multiple parts as only relevant ones are touched."}]}]} />

Use virtual row while reading in order of primary key or its monotonic function fashion. It is useful when searching over multiple parts as only relevant ones are touched.

<h2 id="read_in_order_use_virtual_row_per_block">
  read\_in\_order\_use\_virtual\_row\_per\_block
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "Emit virtual row after each block during read-in-order to allow more frequent source reprioritization in MergingSortedTransform."}]}]} />

When enabled together with `read_in_order_use_virtual_row`, emit a virtual row after each block read (not only at the beginning of each part).
This allows `MergingSortedTransform` to reprioritize sources more frequently, which is useful when downstream filters discard many rows and data is distributed unevenly across parts.
Note that it disables `read_in_order_use_buffering` optimization and preliminary merge (`read_in_order_two_level_merge_threshold`) for reading.

<h2 id="read_overflow_mode">
  read\_overflow\_mode
</h2>

<SettingsInfoBlock type="OverflowMode" default_value="throw" />

What to do when the limit is exceeded.

<h2 id="read_overflow_mode_leaf">
  read\_overflow\_mode\_leaf
</h2>

<SettingsInfoBlock type="OverflowMode" default_value="throw" />

Sets what happens when the volume of data read exceeds one of the leaf limits.

Possible options:

* `throw`: throw an exception (default).
* `break`: stop executing the query and return the partial result.

<h2 id="read_priority">
  read\_priority
</h2>

<SettingsInfoBlock type="Int64" default_value="0" />

Priority to read data from local filesystem or remote filesystem. Only supported for 'pread\_threadpool' method for local filesystem and for `threadpool` method for remote filesystem.

<h2 id="read_through_distributed_cache">
  read\_through\_distributed\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "0"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Allow reading from distributed cache

<h2 id="readonly">
  readonly
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

0 - no read-only restrictions. 1 - only read requests, as well as changing explicitly allowed settings. 2 - only read requests, as well as changing settings, except for the 'readonly' setting.

<h2 id="receive_data_timeout_ms">
  receive\_data\_timeout\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="2000" />

Connection timeout for receiving first packet of data or packet with positive progress from replica

<h2 id="receive_timeout">
  receive\_timeout
</h2>

<SettingsInfoBlock type="Seconds" default_value="300" />

Timeout for receiving data from the network, in seconds. If no bytes were received in this interval, the exception is thrown. If you set this setting on the client, the 'send\_timeout' for the socket will also be set on the corresponding connection end on the server.

<h2 id="recursive_cte_max_steps_in_type_inference">
  recursive\_cte\_max\_steps\_in\_type\_inference
</h2>

<SettingsInfoBlock type="UInt64" default_value="10" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "10"},{"label": "Maximum iterations for inferring column types in recursive CTEs via iterative getLeastSupertype"}]}]} />

Maximum number of iterations for inferring column types in recursive CTEs. Column types are determined by iteratively applying `getLeastSupertype` across the non-recursive and recursive sides of the UNION ALL until convergence. Set to 0 to disable type widening and use the types from the non-recursive part only.

<h2 id="regexp_dict_allow_hyperscan">
  regexp\_dict\_allow\_hyperscan
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Allow regexp\_tree dictionary using Hyperscan library.

<h2 id="regexp_dict_flag_case_insensitive">
  regexp\_dict\_flag\_case\_insensitive
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Use case-insensitive matching for a regexp\_tree dictionary. Can be overridden in individual expressions with (?i) and (?-i).

<h2 id="regexp_dict_flag_dotall">
  regexp\_dict\_flag\_dotall
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Allow '.' to match newline characters for a regexp\_tree dictionary.

<h2 id="regexp_max_matches_per_row">
  regexp\_max\_matches\_per\_row
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000" />

Sets the maximum number of matches for a single regular expression per row. Use it to protect against memory overload when using greedy regular expression in the [extractAllGroupsHorizontal](/reference/functions/regular-functions/string-search-functions#extractAllGroupsHorizontal) function.

Possible values:

* Positive integer.

<h2 id="reject_expensive_hyperscan_regexps">
  reject\_expensive\_hyperscan\_regexps
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Reject patterns which will likely be expensive to evaluate with hyperscan (due to NFA state explosion)

<h2 id="remerge_sort_lowered_memory_bytes_ratio">
  remerge\_sort\_lowered\_memory\_bytes\_ratio
</h2>

<SettingsInfoBlock type="Float" default_value="2" />

If memory usage after remerge does not reduced by this ratio, remerge will be disabled.

<h2 id="remote_filesystem_read_method">
  remote\_filesystem\_read\_method
</h2>

<SettingsInfoBlock type="String" default_value="threadpool" />

Method of reading data from remote filesystem, one of: read, threadpool.

<h2 id="remote_filesystem_read_prefetch">
  remote\_filesystem\_read\_prefetch
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Should use prefetching when reading data from remote filesystem.

<h2 id="remote_fs_read_backoff_max_tries">
  remote\_fs\_read\_backoff\_max\_tries
</h2>

<SettingsInfoBlock type="UInt64" default_value="5" />

Max attempts to read with backoff

<h2 id="remote_fs_read_max_backoff_ms">
  remote\_fs\_read\_max\_backoff\_ms
</h2>

<SettingsInfoBlock type="UInt64" default_value="10000" />

Max wait time when trying to read data for remote disk

<h2 id="remote_read_min_bytes_for_seek">
  remote\_read\_min\_bytes\_for\_seek
</h2>

<SettingsInfoBlock type="UInt64" default_value="4194304" />

Min bytes required for remote read (url, s3) to do seek, instead of read with ignore.

<h2 id="rename_files_after_processing">
  rename\_files\_after\_processing
</h2>

* **Type:** String

* **Default value:** Empty string

This setting allows to specify renaming pattern for files processed by `file` table function. When option is set, all files read by `file` table function will be renamed according to specified pattern with placeholders, only if files processing was successful.

### Placeholders

* `%a` — Full original filename (e.g., "sample.csv").
* `%f` — Original filename without extension (e.g., "sample").
* `%e` — Original file extension with dot (e.g., ".csv").
* `%t` — Timestamp (in microseconds).
* `%%` — Percentage sign ("%").

### Example

* Option: `--rename_files_after_processing="processed_%f_%t%e"`

* Query: `SELECT * FROM file('sample.csv')`

If reading `sample.csv` is successful, file will be renamed to `processed_sample_1683473210851438.csv`

<h2 id="replace_running_query">
  replace\_running\_query
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

When using the HTTP interface, the 'query\_id' parameter can be passed. This is any string that serves as the query identifier.
If a query from the same user with the same 'query\_id' already exists at this time, the behaviour depends on the 'replace\_running\_query' parameter.

`0` (default) – Throw an exception (do not allow the query to run if a query with the same 'query\_id' is already running).

`1` – Cancel the old query and start running the new one.

Set this parameter to 1 for implementing suggestions for segmentation conditions. After entering the next character, if the old query hasn't finished yet, it should be cancelled.

<h2 id="replace_running_query_max_wait_ms">
  replace\_running\_query\_max\_wait\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="5000" />

The wait time for running the query with the same `query_id` to finish, when the [replace\_running\_query](#replace_running_query) setting is active.

Possible values:

* Positive integer.
* 0 — Throwing an exception that does not allow to run a new query if the server already executes a query with the same `query_id`.

<h2 id="replication_wait_for_inactive_replica_timeout">
  replication\_wait\_for\_inactive\_replica\_timeout
</h2>

<SettingsInfoBlock type="Int64" default_value="120" />

Specifies how long (in seconds) to wait for inactive replicas to execute [`ALTER`](/reference/statements/alter/index), [`OPTIMIZE`](/reference/statements/optimize) or [`TRUNCATE`](/reference/statements/truncate) queries.

Possible values:

* `0` — Do not wait.
* Negative integer — Wait for unlimited time.
* Positive integer — The number of seconds to wait.

<h2 id="restore_replace_external_dictionary_source_to_null">
  restore\_replace\_external\_dictionary\_source\_to\_null
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "0"},{"label": "New setting."}]}]} />

Replace external dictionary sources to Null on restore. Useful for testing purposes

<h2 id="restore_replace_external_engines_to_null">
  restore\_replace\_external\_engines\_to\_null
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "0"},{"label": "New setting."}]}]} />

For testing purposes. Replaces all external engines to Null to not initiate external connections.

<h2 id="restore_replace_external_table_functions_to_null">
  restore\_replace\_external\_table\_functions\_to\_null
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "0"},{"label": "New setting."}]}]} />

For testing purposes. Replaces all external table functions to Null to not initiate external connections.

<h2 id="restore_replicated_merge_tree_to_shared_merge_tree">
  restore\_replicated\_merge\_tree\_to\_shared\_merge\_tree
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "0"},{"label": "New setting."}]}]} />

Replace table engine from Replicated*MergeTree -> Shared*MergeTree during RESTORE.

Cloud default value: `1`.

<h2 id="result_overflow_mode">
  result\_overflow\_mode
</h2>

<SettingsInfoBlock type="OverflowMode" default_value="throw" />

Cloud default value: `throw`

Sets what to do if the volume of the result exceeds one of the limits.

Possible values:

* `throw`: throw an exception (default).
* `break`: stop executing the query and return the partial result, as if the
  source data ran out.

Using 'break' is similar to using LIMIT. `Break` interrupts execution only at the
block level. This means that amount of returned rows is greater than
[`max_result_rows`](/reference/settings/session-settings#max_result_rows), multiple of [`max_block_size`](/reference/settings/session-settings#max_block_size)
and depends on [`max_threads`](/reference/settings/session-settings#max_threads).

**Example**

```sql title="Query" theme={null}
SET max_threads = 3, max_block_size = 3333;
SET max_result_rows = 3334, result_overflow_mode = 'break';

SELECT *
FROM numbers_mt(100000)
FORMAT Null;
```

```text title="Result" theme={null}
6666 rows in set. ...
```

<h2 id="rewrite_count_distinct_if_with_count_distinct_implementation">
  rewrite\_count\_distinct\_if\_with\_count\_distinct\_implementation
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.8"},{"label": "1"},{"label": "Rewrite countDistinctIf with count_distinct_implementation configuration"}]}]} />

Allows you to rewrite `countDistcintIf` with [count\_distinct\_implementation](#count_distinct_implementation) setting.

Possible values:

* true — Allow.
* false — Disallow.

<h2 id="rewrite_in_to_join">
  rewrite\_in\_to\_join
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "0"},{"label": "New experimental setting"}]}]} />

Rewrite expressions like 'x IN subquery' to JOIN. This might be useful for optimizing the whole query with join reordering.

<h2 id="rows_before_aggregation">
  rows\_before\_aggregation
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.8"},{"label": "0"},{"label": "Provide exact value for rows_before_aggregation statistic, represents the number of rows read before aggregation"}]}]} />

When enabled, ClickHouse will provide exact value for rows\_before\_aggregation statistic, represents the number of rows read before aggregatio

<h2 id="s3_allow_multipart_copy">
  s3\_allow\_multipart\_copy
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.2"},{"label": "1"},{"label": "New setting."}]}]} />

Allow multipart copy in S3.

<h2 id="s3_allow_parallel_part_upload">
  s3\_allow\_parallel\_part\_upload
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Use multiple threads for s3 multipart upload. It may lead to slightly higher memory usage

<h2 id="s3_check_objects_after_upload">
  s3\_check\_objects\_after\_upload
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Check each uploaded object to s3 with head request to be sure that upload was successful

<h2 id="s3_connect_timeout_ms">
  s3\_connect\_timeout\_ms
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1000"},{"label": "Introduce new dedicated setting for s3 connection timeout"}]}]} />

Connection timeout for host from s3 disks.

<h2 id="s3_create_new_file_on_insert">
  s3\_create\_new\_file\_on\_insert
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables or disables creating a new file on each insert in s3 engine tables. If enabled, on each insert a new S3 object will be created with the key, similar to this pattern:

initial: `data.Parquet.gz` -> `data.1.Parquet.gz` -> `data.2.Parquet.gz`, etc.

Possible values:

* 0 — `INSERT` query creates a new file or fail if file exists and s3\_truncate\_on\_insert is not set.
* 1 — `INSERT` query creates a new file on each insert using suffix (from the second one) if s3\_truncate\_on\_insert is not set.

See more details [here](/integrations/connectors/data-ingestion/AWS/integrating-s3-with-clickhouse#inserting-data).

<h2 id="s3_disable_checksum">
  s3\_disable\_checksum
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Do not calculate a checksum when sending a file to S3. This speeds up writes by avoiding excessive processing passes on a file. It is mostly safe as the data of MergeTree tables is checksummed by ClickHouse anyway, and when S3 is accessed with HTTPS, the TLS layer already provides integrity while transferring through the network. While additional checksums on S3 give defense in depth.

<h2 id="s3_ignore_file_doesnt_exist">
  s3\_ignore\_file\_doesnt\_exist
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "Allow to return 0 rows when the requested files don't exist instead of throwing an exception in S3 table engine"}]}]} />

Ignore absence of file if it does not exist when reading certain keys.

Possible values:

* 1 — `SELECT` returns empty result.
* 0 — `SELECT` throws an exception.

<h2 id="s3_list_object_keys_size">
  s3\_list\_object\_keys\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000" />

Maximum number of files that could be returned in batch by ListObject request

<h2 id="s3_max_connections">
  s3\_max\_connections
</h2>

<SettingsInfoBlock type="UInt64" default_value="1024" />

The maximum number of connections per server.

<h2 id="s3_max_get_burst">
  s3\_max\_get\_burst
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Max number of requests that can be issued simultaneously before hitting request per second limit. By default (0) equals to `s3_max_get_rps`

<h2 id="s3_max_get_rps">
  s3\_max\_get\_rps
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Limit on S3 GET request per second rate before throttling. Zero means unlimited.

<h2 id="s3_max_inflight_parts_for_one_file">
  s3\_max\_inflight\_parts\_for\_one\_file
</h2>

<SettingsInfoBlock type="UInt64" default_value="20" />

The maximum number of a concurrent loaded parts in multipart upload request. 0 means unlimited.

<h2 id="s3_max_part_number">
  s3\_max\_part\_number
</h2>

<SettingsInfoBlock type="UInt64" default_value="10000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "10000"},{"label": "Maximum part number number for s3 upload part"}]}]} />

Maximum part number number for s3 upload part.

<h2 id="s3_max_put_burst">
  s3\_max\_put\_burst
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Max number of requests that can be issued simultaneously before hitting request per second limit. By default (0) equals to `s3_max_put_rps`

<h2 id="s3_max_put_rps">
  s3\_max\_put\_rps
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Limit on S3 PUT request per second rate before throttling. Zero means unlimited.

<h2 id="s3_max_single_operation_copy_size">
  s3\_max\_single\_operation\_copy\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="33554432" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "33554432"},{"label": "Maximum size for a single copy operation in s3"}]}]} />

Maximum size for single-operation copy in s3. This setting is used only if s3\_allow\_multipart\_copy is true.

<h2 id="s3_max_single_part_upload_size">
  s3\_max\_single\_part\_upload\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="33554432" />

The maximum size of object to upload using singlepart upload to S3.

<h2 id="s3_max_single_read_retries">
  s3\_max\_single\_read\_retries
</h2>

<SettingsInfoBlock type="UInt64" default_value="4" />

The maximum number of retries during single S3 read.

<h2 id="s3_max_unexpected_write_error_retries">
  s3\_max\_unexpected\_write\_error\_retries
</h2>

<SettingsInfoBlock type="UInt64" default_value="4" />

The maximum number of retries in case of unexpected errors during S3 write.

<h2 id="s3_max_upload_part_size">
  s3\_max\_upload\_part\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="5368709120" />

The maximum size of part to upload during multipart upload to S3.

<h2 id="s3_min_upload_part_size">
  s3\_min\_upload\_part\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="16777216" />

The minimum size of part to upload during multipart upload to S3.

<h2 id="s3_path_filter_limit">
  s3\_path\_filter\_limit
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "1000"},{"label": "New setting"}]}]} />

Maximum number of `_path` values that can be extracted from query filters to use for file iteration
instead of glob listing. 0 means disabled.

<h2 id="s3_request_timeout_ms">
  s3\_request\_timeout\_ms
</h2>

<SettingsInfoBlock type="UInt64" default_value="30000" />

Idleness timeout for sending and receiving data to/from S3. Fail if a single TCP read or write call blocks for this long.

<h2 id="s3_skip_empty_files">
  s3\_skip\_empty\_files
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "1"},{"label": "We hope it will provide better UX"}]}]} />

Enables or disables skipping empty files in [S3](/reference/engines/table-engines/integrations/s3) engine tables.

Possible values:

* 0 — `SELECT` throws an exception if empty file is not compatible with requested format.
* 1 — `SELECT` returns empty result for empty file.

<h2 id="s3_slow_all_threads_after_network_error">
  s3\_slow\_all\_threads\_after\_network\_error
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "1"},{"label": "New setting"}]}]} />

When set to `true`, all threads executing S3 requests to the same backup endpoint are slowed down
after any single s3 request encounters a retryable network error, such as socket timeout.
When set to `false`, each thread handles S3 request backoff independently of the others.

<h2 id="s3_strict_upload_part_size">
  s3\_strict\_upload\_part\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The exact size of part to upload during multipart upload to S3 (some implementations does not supports variable size parts).

<h2 id="s3_throw_on_zero_files_match">
  s3\_throw\_on\_zero\_files\_match
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Throw an error, when ListObjects request cannot match any files

<h2 id="s3_truncate_on_insert">
  s3\_truncate\_on\_insert
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables or disables truncate before inserts in s3 engine tables. If disabled, an exception will be thrown on insert attempts if an S3 object already exists.

Possible values:

* 0 — `INSERT` query creates a new file or fail if file exists and s3\_create\_new\_file\_on\_insert is not set.
* 1 — `INSERT` query replaces existing content of the file with the new data.

See more details [here](/integrations/connectors/data-ingestion/AWS/integrating-s3-with-clickhouse#inserting-data).

<h2 id="s3_upload_part_size_multiply_factor">
  s3\_upload\_part\_size\_multiply\_factor
</h2>

<SettingsInfoBlock type="UInt64" default_value="2" />

Multiply s3\_min\_upload\_part\_size by this factor each time s3\_multiply\_parts\_count\_threshold parts were uploaded from a single write to S3.

<h2 id="s3_upload_part_size_multiply_parts_count_threshold">
  s3\_upload\_part\_size\_multiply\_parts\_count\_threshold
</h2>

<SettingsInfoBlock type="UInt64" default_value="500" />

Each time this number of parts was uploaded to S3, s3\_min\_upload\_part\_size is multiplied by s3\_upload\_part\_size\_multiply\_factor.

<h2 id="s3_uri_style">
  s3\_uri\_style
</h2>

<SettingsInfoBlock type="S3UriStyle" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "auto"},{"label": "New setting."}]}]} />

Force the s3 endpoint style. Possible values: auto, virtual\_hosted, path.

<h2 id="s3_use_adaptive_timeouts">
  s3\_use\_adaptive\_timeouts
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

When set to `true` than for all s3 requests first two attempts are made with low send and receive timeouts.
When set to `false` than all attempts are made with identical timeouts.

<h2 id="s3_validate_request_settings">
  s3\_validate\_request\_settings
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "1"},{"label": "Allow to disable S3 request settings validation"}]}]} />

Enables s3 request settings validation.
Possible values:

* 1 — validate settings.
* 0 — do not validate settings.

<h2 id="s3queue_default_zookeeper_path">
  s3queue\_default\_zookeeper\_path
</h2>

<SettingsInfoBlock type="String" default_value="/clickhouse/s3queue/" />

Default zookeeper path prefix for S3Queue engine

<h2 id="s3queue_enable_logging_to_s3queue_log">
  s3queue\_enable\_logging\_to\_s3queue\_log
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enable writing to system.s3queue\_log. The value can be overwritten per table with table settings

<h2 id="s3queue_keeper_fault_injection_probability">
  s3queue\_keeper\_fault\_injection\_probability
</h2>

<SettingsInfoBlock type="Float" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "0"},{"label": "New setting."}]}]} />

Keeper fault injection probability for S3Queue.

<h2 id="s3queue_migrate_old_metadata_to_buckets">
  s3queue\_migrate\_old\_metadata\_to\_buckets
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "0"},{"label": "New setting."}]}]} />

Migrate old metadata structure of S3Queue table to a new one

<h2 id="schema_inference_cache_require_modification_time_for_url">
  schema\_inference\_cache\_require\_modification\_time\_for\_url
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Use schema from cache for URL with last modification time validation (for URLs with Last-Modified header)

<h2 id="schema_inference_use_cache_for_azure">
  schema\_inference\_use\_cache\_for\_azure
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Use cache in schema inference while using azure table functio

<h2 id="schema_inference_use_cache_for_file">
  schema\_inference\_use\_cache\_for\_file
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Use cache in schema inference while using file table functio

<h2 id="schema_inference_use_cache_for_hdfs">
  schema\_inference\_use\_cache\_for\_hdfs
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Use cache in schema inference while using hdfs table functio

<h2 id="schema_inference_use_cache_for_s3">
  schema\_inference\_use\_cache\_for\_s3
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Use cache in schema inference while using s3 table functio

<h2 id="schema_inference_use_cache_for_url">
  schema\_inference\_use\_cache\_for\_url
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Use cache in schema inference while using url table functio

<h2 id="secondary_indices_enable_bulk_filtering">
  secondary\_indices\_enable\_bulk\_filtering
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "1"},{"label": "A new algorithm for filtering by data skipping indices"}]}]} />

Enable the bulk filtering algorithm for indices. It is expected to be always better, but we have this setting for compatibility and control.

<h2 id="select_sequential_consistency">
  select\_sequential\_consistency
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<Note>
  This setting differ in behavior between SharedMergeTree and ReplicatedMergeTree, see [SharedMergeTree consistency](/products/cloud/features/infrastructure/shared-merge-tree#consistency) for more information about the behavior of `select_sequential_consistency` in SharedMergeTree.
</Note>

Enables or disables sequential consistency for `SELECT` queries. Requires `insert_quorum_parallel` to be disabled (enabled by default).

Possible values:

* 0 — Disabled.
* 1 — Enabled.

Usage

When sequential consistency is enabled, ClickHouse allows the client to execute the `SELECT` query only for those replicas that contain data from all previous `INSERT` queries executed with `insert_quorum`. If the client refers to a partial replica, ClickHouse will generate an exception. The SELECT query will not include data that has not yet been written to the quorum of replicas.

When `insert_quorum_parallel` is enabled (the default), then `select_sequential_consistency` does not work. This is because parallel `INSERT` queries can be written to different sets of quorum replicas so there is no guarantee a single replica will have received all writes.

See also:

* [insert\_quorum](#insert_quorum)
* [insert\_quorum\_timeout](#insert_quorum_timeout)
* [insert\_quorum\_parallel](#insert_quorum_parallel)

<h2 id="send_logs_level">
  send\_logs\_level
</h2>

<SettingsInfoBlock type="LogsLevel" default_value="fatal" />

Send server text logs with specified minimum level to client. Valid values: 'trace', 'debug', 'information', 'warning', 'error', 'fatal', 'none'

<h2 id="send_logs_source_regexp">
  send\_logs\_source\_regexp
</h2>

Send server text logs with specified regexp to match log source name. Empty means all sources.

<h2 id="send_profile_events">
  send\_profile\_events
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1"},{"label": "New setting. Whether to send profile events to the clients."}]}]} />

Enables or disables sending of [ProfileEvents](/resources/develop-contribute/native-protocol/server#profile-events) packets to the client.

This can be disabled to reduce network traffic for clients that do not require profile events.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="send_progress_in_http_headers">
  send\_progress\_in\_http\_headers
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables or disables `X-ClickHouse-Progress` HTTP response headers in `clickhouse-server` responses.

For more information, read the [HTTP interface description](/concepts/features/interfaces/http).

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="send_table_structure_on_insert_with_inline_data">
  send\_table\_structure\_on\_insert\_with\_inline\_data
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1"},{"label": "New setting to control whether server sends table structure for INSERT queries with inline data."}]}]} />

If disabled and the INSERT query contains inline data, the server will not send the table structure and column defaults back to the client over the native protocol. Instead, the server will parse the inline data itself. This can improve performance for many small inserts over the native protocol.

<h2 id="send_timeout">
  send\_timeout
</h2>

<SettingsInfoBlock type="Seconds" default_value="300" />

Timeout for sending data to the network, in seconds. If a client needs to send some data but is not able to send any bytes in this interval, the exception is thrown. If you set this setting on the client, the 'receive\_timeout' for the socket will also be set on the corresponding connection end on the server.

<h2 id="serialize_query_plan">
  serialize\_query\_plan
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "0"},{"label": "NewSetting"}]}]} />

Serialize query plan for distributed processing

<h2 id="serialize_string_in_memory_with_zero_byte">
  serialize\_string\_in\_memory\_with\_zero\_byte
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "New setting"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "1"},{"label": "New setting"}]}]} />

Serialize String values during aggregation with zero byte at the end. Enable to keep compatibility when querying cluster of incompatible versions.

<h2 id="session_timezone">
  session\_timezone
</h2>

Sets the implicit time zone of the current session or query.
The implicit time zone is the time zone applied to values of type DateTime/DateTime64 which have no explicitly specified time zone.
The setting takes precedence over the globally configured (server-level) implicit time zone.
A value of '' (empty string) means that the implicit time zone of the current session or query is equal to the [server time zone](/reference/settings/server-settings/settings#timezone).

You can use functions `timeZone()` and `serverTimeZone()` to get the session time zone and server time zone.

Possible values:

* Any time zone name from `system.time_zones`, e.g. `Europe/Berlin`, `UTC` or `Zulu`

Examples:

```sql theme={null}
SELECT timeZone(), serverTimeZone() FORMAT CSV

"Europe/Berlin","Europe/Berlin"
```

```sql theme={null}
SELECT timeZone(), serverTimeZone() SETTINGS session_timezone = 'Asia/Novosibirsk' FORMAT CSV

"Asia/Novosibirsk","Europe/Berlin"
```

Assign session time zone 'America/Denver' to the inner DateTime without explicitly specified time zone:

```sql theme={null}
SELECT toDateTime64(toDateTime64('1999-12-12 23:23:23.123', 3), 3, 'Europe/Zurich') SETTINGS session_timezone = 'America/Denver' FORMAT TSV

1999-12-13 07:23:23.123
```

<Warning>
  Not all functions that parse DateTime/DateTime64 respect `session_timezone`. This can lead to subtle errors.
  See the following example and explanation.
</Warning>

```sql theme={null}
CREATE TABLE test_tz (`d` DateTime('UTC')) ENGINE = Memory AS SELECT toDateTime('2000-01-01 00:00:00', 'UTC');

SELECT *, timeZone() FROM test_tz WHERE d = toDateTime('2000-01-01 00:00:00') SETTINGS session_timezone = 'Asia/Novosibirsk'
0 rows in set.

SELECT *, timeZone() FROM test_tz WHERE d = '2000-01-01 00:00:00' SETTINGS session_timezone = 'Asia/Novosibirsk'
┌───────────────────d─┬─timeZone()───────┐
│ 2000-01-01 00:00:00 │ Asia/Novosibirsk │
└─────────────────────┴──────────────────┘
```

This happens due to different parsing pipelines:

* `toDateTime()` without explicitly given time zone used in the first `SELECT` query honors setting `session_timezone` and the global time zone.
* In the second query, a DateTime is parsed from a String, and inherits the type and time zone of the existing column`d`. Thus, setting `session_timezone` and the global time zone are not honored.

**See also**

* [timezone](/reference/settings/server-settings/settings#timezone)

<h2 id="set_overflow_mode">
  set\_overflow\_mode
</h2>

<SettingsInfoBlock type="OverflowMode" default_value="throw" />

Sets what happens when the amount of data exceeds one of the limits.

Possible values:

* `throw`: throw an exception (default).
* `break`: stop executing the query and return the partial result, as if the
  source data ran out.

<h2 id="shared_merge_tree_sequential_consistency_initial_parts_update_backoff_ms">
  shared\_merge\_tree\_sequential\_consistency\_initial\_parts\_update\_backoff\_ms
</h2>

<SettingsInfoBlock type="UInt64" default_value="50" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "50"},{"label": "New setting to reduce sporadic UNFINISHED errors in queries with sequential consistency for SharedMergeTree."}]}]} />

Initial backoff in milliseconds for parts update when using `select_sequential_consistency` with `SharedMergeTree`. Only available in ClickHouse Cloud.

<h2 id="shared_merge_tree_sequential_consistency_max_parts_update_backoff_ms">
  shared\_merge\_tree\_sequential\_consistency\_max\_parts\_update\_backoff\_ms
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1000"},{"label": "New setting to reduce sporadic UNFINISHED errors in queries with sequential consistency for SharedMergeTree."}]}]} />

Max backoff in milliseconds for parts update when using `select_sequential_consistency` with `SharedMergeTree`. Only available in ClickHouse Cloud.

<h2 id="shared_merge_tree_sequential_consistency_parts_update_max_retries">
  shared\_merge\_tree\_sequential\_consistency\_parts\_update\_max\_retries
</h2>

<SettingsInfoBlock type="UInt64" default_value="10" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "10"},{"label": "New setting to reduce sporadic UNFINISHED errors in queries with sequential consistency for SharedMergeTree."}]}]} />

Max retries for parts update when using `select_sequential_consistency` with `SharedMergeTree`. Only available in ClickHouse Cloud.

<h2 id="shared_merge_tree_sync_parts_on_partition_operations">
  shared\_merge\_tree\_sync\_parts\_on\_partition\_operations
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.12"},{"label": "1"},{"label": "New setting. By default parts are always synchronized"}]}]} />

Automatically synchronize set of data parts after MOVE|REPLACE|ATTACH partition operations in SMT tables. Cloud only

<h2 id="short_circuit_function_evaluation">
  short\_circuit\_function\_evaluation
</h2>

<SettingsInfoBlock type="ShortCircuitFunctionEvaluation" default_value="enable" />

Allows calculating the [if](/reference/functions/regular-functions/conditional-functions#if), [multiIf](/reference/functions/regular-functions/conditional-functions#multiIf), [and](/reference/functions/regular-functions/logical-functions#and), and [or](/reference/functions/regular-functions/logical-functions#or) functions according to a [short scheme](https://en.wikipedia.org/wiki/Short-circuit_evaluation). This helps optimize the execution of complex expressions in these functions and prevent possible exceptions (such as division by zero when it is not expected).

Possible values:

* `enable` — Enables short-circuit function evaluation for functions that are suitable for it (can throw an exception or computationally heavy).
* `force_enable` — Enables short-circuit function evaluation for all functions.
* `disable` — Disables short-circuit function evaluation.

<h2 id="short_circuit_function_evaluation_for_nulls">
  short\_circuit\_function\_evaluation\_for\_nulls
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "Allow to execute functions with Nullable arguments only on rows with non-NULL values in all arguments"}]}]} />

Optimizes evaluation of functions that return NULL when any argument is NULL. When the percentage of NULL values in the function's arguments exceeds the short\_circuit\_function\_evaluation\_for\_nulls\_threshold, the system skips evaluating the function row-by-row. Instead, it immediately returns NULL for all rows, avoiding unnecessary computation.

<h2 id="short_circuit_function_evaluation_for_nulls_threshold">
  short\_circuit\_function\_evaluation\_for\_nulls\_threshold
</h2>

<SettingsInfoBlock type="Double" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "Ratio threshold of NULL values to execute functions with Nullable arguments only on rows with non-NULL values in all arguments. Applies when setting short_circuit_function_evaluation_for_nulls is enabled."}]}]} />

Ratio threshold of NULL values to execute functions with Nullable arguments only on rows with non-NULL values in all arguments. Applies when setting short\_circuit\_function\_evaluation\_for\_nulls is enabled.
When the ratio of rows containing NULL values to the total number of rows exceeds this threshold, these rows containing NULL values will not be evaluated.

<h2 id="show_processlist_include_internal">
  show\_processlist\_include\_internal
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1"},{"label": "New setting."}]}]} />

Show internal auxiliary processes in the `SHOW PROCESSLIST` query output.

Internal processes include dictionary reloads, refreshable materialized view reloads, auxiliary `SELECT`s executed in `SHOW ...` queries, auxiliary `CREATE DATABASE ...` queries executed internally to accommodate broken tables and more.

<h2 id="show_remote_databases_in_system_tables">
  show\_remote\_databases\_in\_system\_tables
</h2>

**Aliases**: `show_data_lake_catalogs_in_system_tables`

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "0"},{"label": "Renamed from `show_data_lake_catalogs_in_system_tables` and broadened to also hide `MySQL` and `PostgreSQL` databases from `system.tables`, `system.columns` and `system.completions` by default, since enumerating their tables requires expensive remote calls. Users who relied on the previous behavior must set this setting to `true`. The old name is kept as an alias."}]}]} />

Enables showing remote databases (data lake catalogs, MySQL, PostgreSQL) in system tables.

<h2 id="show_table_uuid_in_table_create_query_if_not_nil">
  show\_table\_uuid\_in\_table\_create\_query\_if\_not\_nil
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "20.7"},{"label": "0"},{"label": "Stop showing  UID of the table in its CREATE query for Engine=Atomic"}]}]} />

Sets the `SHOW TABLE` query display.

Possible values:

* 0 — The query will be displayed without table UUID.
* 1 — The query will be displayed with table UUID.

<h2 id="single_join_prefer_left_table">
  single\_join\_prefer\_left\_table
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

For single JOIN in case of identifier ambiguity prefer left table

<h2 id="skip_redundant_aliases_in_udf">
  skip\_redundant\_aliases\_in\_udf
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.12"},{"label": "0"},{"label": "When enabled, this allows you to use the same user defined function several times for several materialized columns in the same table."}]}]} />

Redundant aliases are not used (substituted) in user-defined functions in order to simplify it's usage.

Possible values:

* 1 — The aliases are skipped (substituted) in UDFs.
* 0 — The aliases are not skipped (substituted) in UDFs.

**Example**

The difference between enabled and disabled:

Query:

```sql theme={null}
SET skip_redundant_aliases_in_udf = 0;
CREATE FUNCTION IF NOT EXISTS test_03274 AS ( x ) -> ((x + 1 as y, y + 2));

EXPLAIN SYNTAX SELECT test_03274(4 + 2);
```

Result:

```text theme={null}
SELECT ((4 + 2) + 1 AS y, y + 2)
```

Query:

```sql theme={null}
SET skip_redundant_aliases_in_udf = 1;
CREATE FUNCTION IF NOT EXISTS test_03274 AS ( x ) -> ((x + 1 as y, y + 2));

EXPLAIN SYNTAX SELECT test_03274(4 + 2);
```

Result:

```text theme={null}
SELECT ((4 + 2) + 1, ((4 + 2) + 1) + 2)
```

<h2 id="skip_unavailable_shards">
  skip\_unavailable\_shards
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables or disables silently skipping of unavailable shards.

Shard is considered unavailable if all its replicas are unavailable. A replica is unavailable in the following cases:

* ClickHouse can't connect to replica for any reason.

  When connecting to a replica, ClickHouse performs several attempts. If all these attempts fail, the replica is considered unavailable.

* Replica can't be resolved through DNS.

  If replica's hostname can't be resolved through DNS, it can indicate the following situations:

  * Replica's host has no DNS record. It can occur in systems with dynamic DNS, for example, [Kubernetes](https://kubernetes.io), where nodes can be unresolvable during downtime, and this is not an error.

  * Configuration error. ClickHouse configuration file contains a wrong hostname.

Possible values:

* 1 — skipping enabled.

  If a shard is unavailable, ClickHouse returns a result based on partial data and does not report node availability issues.

* 0 — skipping disabled.

  If a shard is unavailable, ClickHouse throws an exception.

<h2 id="sleep_after_receiving_query_ms">
  sleep\_after\_receiving\_query\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="0" />

Time to sleep after receiving query in TCPHandler

<h2 id="sleep_in_send_data_ms">
  sleep\_in\_send\_data\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="0" />

Time to sleep in sending data in TCPHandler

<h2 id="sleep_in_send_tables_status_ms">
  sleep\_in\_send\_tables\_status\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="0" />

Time to sleep in sending tables status response in TCPHandler

<h2 id="sort_overflow_mode">
  sort\_overflow\_mode
</h2>

<SettingsInfoBlock type="OverflowMode" default_value="throw" />

Sets what happens if the number of rows received before sorting exceeds one of the limits.

Possible values:

* `throw`: throw an exception.
* `break`: stop executing the query and return the partial result.

<h2 id="split_intersecting_parts_ranges_into_layers_final">
  split\_intersecting\_parts\_ranges\_into\_layers\_final
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "1"},{"label": "Allow to split intersecting parts ranges into layers during FINAL optimization"}]}, {"id": "row-2","items": [{"label": "24.1"},{"label": "1"},{"label": "Allow to split intersecting parts ranges into layers during FINAL optimization"}]}]} />

Split intersecting parts ranges into layers during FINAL optimizatio

<h2 id="split_parts_ranges_into_intersecting_and_non_intersecting_final">
  split\_parts\_ranges\_into\_intersecting\_and\_non\_intersecting\_final
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.2"},{"label": "1"},{"label": "Allow to split parts ranges into intersecting and non intersecting during FINAL optimization"}]}, {"id": "row-2","items": [{"label": "24.1"},{"label": "1"},{"label": "Allow to split parts ranges into intersecting and non intersecting during FINAL optimization"}]}]} />

Split parts ranges into intersecting and non intersecting during FINAL optimizatio

<h2 id="splitby_max_substrings_includes_remaining_string">
  splitby\_max\_substrings\_includes\_remaining\_string
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Controls whether function [splitBy\*()](/reference/functions/regular-functions/splitting-merging-functions) with argument `max_substrings` > 0 will include the remaining string in the last element of the result array.

Possible values:

* `0` - The remaining string will not be included in the last element of the result array.
* `1` - The remaining string will be included in the last element of the result array. This is the behavior of Spark's [`split()`](https://spark.apache.org/docs/3.1.2/api/python/reference/api/pyspark.sql.functions.split.html) function and Python's ['string.split()'](https://docs.python.org/3/library/stdtypes.html#str.split) method.

<h2 id="stop_refreshable_materialized_views_on_startup">
  stop\_refreshable\_materialized\_views\_on\_startup
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

On server startup, prevent scheduling of refreshable materialized views, as if with SYSTEM STOP VIEWS. You can manually start them with `SYSTEM START VIEWS` or `SYSTEM START VIEW <name>` afterwards. Also applies to newly created views. Has no effect on non-refreshable materialized views.

<h2 id="storage_file_read_method">
  storage\_file\_read\_method
</h2>

<SettingsInfoBlock type="LocalFSReadMethod" default_value="pread" />

Method of reading data from storage file, one of: `read`, `pread`, `mmap`. The mmap method does not apply to clickhouse-server (it's intended for clickhouse-local).

<h2 id="storage_system_stack_trace_pipe_read_timeout_ms">
  storage\_system\_stack\_trace\_pipe\_read\_timeout\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="100" />

Maximum time to read from a pipe for receiving information from the threads when querying the `system.stack_trace` table. This setting is used for testing purposes and not meant to be changed by users.

<h2 id="stream_flush_interval_ms">
  stream\_flush\_interval\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="7500" />

Works for tables with streaming in the case of a timeout, or when a thread generates [max\_insert\_block\_size](#max_insert_block_size) rows.

The default value is 7500.

The smaller the value, the more often data is flushed into the table. Setting the value too low leads to poor performance.

<h2 id="stream_like_engine_allow_direct_select">
  stream\_like\_engine\_allow\_direct\_select
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.12"},{"label": "0"},{"label": "Do not allow direct select for Kafka/RabbitMQ/FileLog by default"}]}]} />

Allow direct SELECT query for Kafka, RabbitMQ, FileLog, Redis Streams, S3Queue, AzureQueue and NATS engines. In case there are attached materialized views, SELECT query is not allowed even if this setting is enabled.
If there are no attached materialized views, enabling this setting allows to read data. Be aware that usually the read data is removed from the queue. In order to avoid removing read data the related engine settings should be configured properly.

<h2 id="stream_like_engine_insert_queue">
  stream\_like\_engine\_insert\_queue
</h2>

When stream-like engine reads from multiple queues, the user will need to select one queue to insert into when writing. Used by Redis Streams and NATS.

<h2 id="stream_poll_timeout_ms">
  stream\_poll\_timeout\_ms
</h2>

<SettingsInfoBlock type="Milliseconds" default_value="500" />

Timeout for polling data from/to streaming storages.

<h2 id="system_events_show_zero_values">
  system\_events\_show\_zero\_values
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Allows to select zero-valued events from [`system.events`](/reference/system-tables/events).

Some monitoring systems require passing all the metrics values to them for each checkpoint, even if the metric value is zero.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

**Examples**

Query

```sql theme={null}
SELECT * FROM system.events WHERE event='QueryMemoryLimitExceeded';
```

Result

```text theme={null}
Ok.
```

Query

```sql theme={null}
SET system_events_show_zero_values = 1;
SELECT * FROM system.events WHERE event='QueryMemoryLimitExceeded';
```

Result

```text theme={null}
┌─event────────────────────┬─value─┬─description───────────────────────────────────────────┐
│ QueryMemoryLimitExceeded │     0 │ Number of times when memory limit exceeded for query. │
└──────────────────────────┴───────┴───────────────────────────────────────────────────────┘
```

<h2 id="system_metric_log_show_zero_values_in_histograms">
  system\_metric\_log\_show\_zero\_values\_in\_histograms
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "New setting controlling whether zero-valued histogram data is written to the histograms nested column of system.metric_log."}]}]} />

Controls whether zero-valued histogram data is written to the `histograms` nested column of `system.metric_log`.

By default, histograms whose total observation `count` is zero are skipped, and within each emitted histogram, bucket entries with no observations are also omitted from the `histogram` map. Enable this to write every histogram and every bucket regardless of count — useful for monitoring systems that require every metric to appear at every checkpoint.

Possible values:

* 0 — Disabled. Histograms with `count = 0` are not emitted; emitted histograms include only buckets that received at least one observation.
* 1 — Enabled. All histograms are written, and every bucket boundary appears in `histogram`.

<h2 id="table_engine_read_through_distributed_cache">
  table\_engine\_read\_through\_distributed\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "0"},{"label": "New setting"}]}]} />

Only has an effect in ClickHouse Cloud. Allow reading from distributed cache via table engines / table functions (s3, azure, etc)

<h2 id="table_function_remote_max_addresses">
  table\_function\_remote\_max\_addresses
</h2>

<SettingsInfoBlock type="UInt64" default_value="1000" />

Sets the maximum number of addresses generated from patterns for the [remote](/reference/functions/table-functions/remote) function.

Possible values:

* Positive integer.

<h2 id="tcp_keep_alive_timeout">
  tcp\_keep\_alive\_timeout
</h2>

<SettingsInfoBlock type="Seconds" default_value="290" />

The time in seconds the connection needs to remain idle before TCP starts sending keepalive probes

<h2 id="temporary_data_in_cache_reserve_space_wait_lock_timeout_milliseconds">
  temporary\_data\_in\_cache\_reserve\_space\_wait\_lock\_timeout\_milliseconds
</h2>

<SettingsInfoBlock type="UInt64" default_value="600000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.4"},{"label": "600000"},{"label": "Wait time to lock cache for space reservation in temporary data in filesystem cache"}]}]} />

Wait time to lock cache for space reservation for temporary data in filesystem cache

<h2 id="temporary_files_buffer_size">
  temporary\_files\_buffer\_size
</h2>

<SettingsInfoBlock type="NonZeroUInt64" default_value="1048576" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "1048576"},{"label": "New setting"}]}]} />

Size of the buffer for temporary files writers. Larger buffer size means less system calls, but more memory consumption.

<h2 id="temporary_files_codec">
  temporary\_files\_codec
</h2>

<SettingsInfoBlock type="String" default_value="LZ4" />

Sets compression codec for temporary files used in sorting and joining operations on disk.

Possible values:

* LZ4 — [LZ4](https://en.wikipedia.org/wiki/LZ4_\(compression_algorithm\)) compression is applied.
* NONE — No compression is applied.

<h2 id="text_index_density_threshold">
  text\_index\_density\_threshold
</h2>

<SettingsInfoBlock type="Float" default_value="0.2" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "0.2"},{"label": "New setting for lazy posting list density threshold"}]}]} />

Density threshold for algorithm selection in lazy posting list mode.
Below threshold: leapfrog intersection. At or above: brute-force bitmap.

<h2 id="text_index_hint_max_selectivity">
  text\_index\_hint\_max\_selectivity
</h2>

<SettingsInfoBlock type="Float" default_value="0.2" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "0.2"},{"label": "New setting"}]}]} />

Maximal selectivity of the filter to use the hint built from the inverted text index.

<h2 id="text_index_like_max_postings_to_read">
  text\_index\_like\_max\_postings\_to\_read
</h2>

<SettingsInfoBlock type="UInt64" default_value="50" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "50"},{"label": "New setting"}]}]} />

Maximum number of large postings to read when text index LIKE evaluation by the dictionary scan is enabled.

Requires `use_text_index_like_evaluation_by_dictionary_scan` to be enabled.

<h2 id="text_index_like_min_pattern_length">
  text\_index\_like\_min\_pattern\_length
</h2>

<SettingsInfoBlock type="UInt64" default_value="4" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "4"},{"label": "New setting"}]}]} />

Minimum length of the alphanumeric needle in a LIKE/ILIKE pattern required to use the text index LIKE evaluation by the dictionary scan.
Patterns shorter than this threshold match too many dictionary tokens and are skipped to avoid expensive scans.

Requires `use_text_index_like_evaluation_by_dictionary_scan` to be enabled.

<h2 id="text_index_posting_list_apply_mode">
  text\_index\_posting\_list\_apply\_mode
</h2>

<SettingsInfoBlock type="TextIndexPostingListApplyMode" default_value="materialize" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "materialize"},{"label": "New setting for lazy posting list apply mode"}]}]} />

Controls how posting lists are applied during text index queries.
'materialize' (default) eagerly decodes posting lists into Roaring Bitmaps.
'lazy' uses cursor-based on-demand decoding (requires V2 index format and allow\_experimental\_text\_index\_lazy\_apply).

<h2 id="throw_if_no_data_to_insert">
  throw\_if\_no\_data\_to\_insert
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Allows or forbids empty INSERTs, enabled by default (throws an error on an empty insert). Only applies to INSERTs using [`clickhouse-client`](/concepts/features/interfaces/cli) or using the [gRPC interface](/concepts/features/interfaces/grpc).

<h2 id="throw_on_error_from_cache_on_write_operations">
  throw\_on\_error\_from\_cache\_on\_write\_operations
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Ignore error from cache when caching on write operations (INSERT, merges)

<h2 id="throw_on_max_partitions_per_insert_block">
  throw\_on\_max\_partitions\_per\_insert\_block
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Allows you to control the behaviour when `max_partitions_per_insert_block` is reached.

Possible values:

* `true`  - When an insert block reaches `max_partitions_per_insert_block`, an exception is raised.
* `false` - Logs a warning when `max_partitions_per_insert_block` is reached.

<Tip>
  This can be useful if you're trying to understand the impact on users when changing [`max_partitions_per_insert_block`](/reference/settings/session-settings#max_partitions_per_insert_block).
</Tip>

<h2 id="throw_on_unsupported_query_inside_transaction">
  throw\_on\_unsupported\_query\_inside\_transaction
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Throw exception if unsupported query is used inside transactio

<h2 id="timeout_before_checking_execution_speed">
  timeout\_before\_checking\_execution\_speed
</h2>

<SettingsInfoBlock type="Seconds" default_value="10" />

Checks that execution speed is not too slow (no less than `min_execution_speed`),
after the specified time in seconds has expired.

<h2 id="timeout_overflow_mode">
  timeout\_overflow\_mode
</h2>

<SettingsInfoBlock type="OverflowMode" default_value="throw" />

Sets what to do if the query is run longer than the `max_execution_time` or the
estimated running time is longer than `max_estimated_execution_time`.

Possible values:

* `throw`: throw an exception (default).
* `break`: stop executing the query and return the partial result, as if the
  source data ran out.

<h2 id="timeout_overflow_mode_leaf">
  timeout\_overflow\_mode\_leaf
</h2>

<SettingsInfoBlock type="OverflowMode" default_value="throw" />

Sets what happens when the query in leaf node run longer than `max_execution_time_leaf`.

Possible values:

* `throw`: throw an exception (default).
* `break`: stop executing the query and return the partial result, as if the
  source data ran out.

<h2 id="totals_auto_threshold">
  totals\_auto\_threshold
</h2>

<SettingsInfoBlock type="Float" default_value="0.5" />

The threshold for `totals_mode = 'auto'`.
See the section "WITH TOTALS modifier".

<h2 id="totals_mode">
  totals\_mode
</h2>

<SettingsInfoBlock type="TotalsMode" default_value="after_having_exclusive" />

How to calculate TOTALS when HAVING is present, as well as when max\_rows\_to\_group\_by and group\_by\_overflow\_mode = 'any' are present.
See the section "WITH TOTALS modifier".

<h2 id="trace_profile_events">
  trace\_profile\_events
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables or disables collecting stacktraces on each update of profile events along with the name of profile event and the value of increment and sending them into [trace\_log](/reference/system-tables/trace_log).

Possible values:

* 1 — Tracing of profile events enabled.
* 0 — Tracing of profile events disabled.

<h2 id="trace_profile_events_list">
  trace\_profile\_events\_list
</h2>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": ""},{"label": "New setting"}]}]} />

When the setting `trace_profile_events` is enabled, limit the traced events to the specified list of comma-separated names.
If the `trace_profile_events_list` is an empty string (by default), trace all profile events.

Example value: 'DiskS3ReadMicroseconds,DiskS3ReadRequestsCount,SelectQueryTimeMicroseconds,ReadBufferFromS3Bytes'

Using this setting allows more precise collection of data for a large number of queries, because otherwise the vast amount of events can overflow the internal system log queue and some portion of them will be dropped.

<h2 id="transfer_overflow_mode">
  transfer\_overflow\_mode
</h2>

<SettingsInfoBlock type="OverflowMode" default_value="throw" />

Sets what happens when the amount of data exceeds one of the limits.

Possible values:

* `throw`: throw an exception (default).
* `break`: stop executing the query and return the partial result, as if the
  source data ran out.

<h2 id="transform_null_in">
  transform\_null\_in
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Enables equality of [NULL](/reference/syntax#null) values for [IN](/reference/statements/in) operator.

By default, `NULL` values can't be compared because `NULL` means undefined value. Thus, comparison `expr = NULL` must always return `false`. With this setting `NULL = NULL` returns `true` for `IN` operator.

Possible values:

* 0 — Comparison of `NULL` values in `IN` operator returns `false`.
* 1 — Comparison of `NULL` values in `IN` operator returns `true`.

**Example**

Consider the `null_in` table:

```text theme={null}
┌──idx─┬─────i─┐
│    1 │     1 │
│    2 │  NULL │
│    3 │     3 │
└──────┴───────┘
```

Query:

```sql theme={null}
SELECT idx, i FROM null_in WHERE i IN (1, NULL) SETTINGS transform_null_in = 0;
```

Result:

```text theme={null}
┌──idx─┬────i─┐
│    1 │    1 │
└──────┴──────┘
```

Query:

```sql theme={null}
SELECT idx, i FROM null_in WHERE i IN (1, NULL) SETTINGS transform_null_in = 1;
```

Result:

```text theme={null}
┌──idx─┬─────i─┐
│    1 │     1 │
│    2 │  NULL │
└──────┴───────┘
```

**See Also**

* [NULL Processing in IN Operators](/reference/statements/in#null-processing)

<h2 id="traverse_shadow_remote_data_paths">
  traverse\_shadow\_remote\_data\_paths
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "Traverse shadow directory when query system.remote_data_paths."}]}]} />

Traverse frozen data (shadow directory) in addition to actual table data when query system.remote\_data\_paths

<h2 id="union_default_mode">
  union\_default\_mode
</h2>

Sets a mode for combining `SELECT` query results. The setting is only used when shared with [UNION](/reference/statements/select/union) without explicitly specifying the `UNION ALL` or `UNION DISTINCT`.

Possible values:

* `'DISTINCT'` — ClickHouse outputs rows as a result of combining queries removing duplicate rows.
* `'ALL'` — ClickHouse outputs all rows as a result of combining queries including duplicate rows.
* `''` — ClickHouse generates an exception when used with `UNION`.

See examples in [UNION](/reference/statements/select/union).

<h2 id="unique_key_max_encoded_size">
  unique\_key\_max\_encoded\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="256" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "256"},{"label": "New setting: maximum size (bytes) of the order-preserving binary encoding of a single UNIQUE KEY row"}]}]} />

Maximum size (in bytes) of the order-preserving binary encoding of a single `UNIQUE KEY` row.

<h2 id="unknown_packet_in_send_data">
  unknown\_packet\_in\_send\_data
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

Send unknown packet instead of data Nth data packet

<h2 id="update_parallel_mode">
  update\_parallel\_mode
</h2>

<SettingsInfoBlock type="UpdateParallelMode" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "auto"},{"label": "A new setting"}]}]} />

Determines the behavior of concurrent update queries.

Possible values:

* `sync` - run sequentially all `UPDATE` queries.
* `auto` - run sequentially only `UPDATE` queries with dependencies between columns updated in one query and columns used in expressions of another query.
* `async` - do not synchronize update queries.

<h2 id="update_sequential_consistency">
  update\_sequential\_consistency
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "1"},{"label": "A new setting"}]}]} />

If true set of parts is updated to the latest version before execution of update.

<h2 id="url_base">
  url\_base
</h2>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": ""},{"label": "New setting to specify the base URL for resolving relative URLs in the url table function and URL table engine."}]}]} />

The base URL used to resolve relative URLs in the [url](/reference/functions/table-functions/url) table function and the [URL](/reference/engines/table-engines/special/url) table engine.

When set, relative URLs are resolved as follows:

* Path-relative URL (e.g. `data.csv`): merged with the base URL path per RFC 3986. Everything after the last `/` in the base path is replaced by the relative URL, so a trailing slash matters: `https://example.com/dir/` + `data.csv` = `https://example.com/dir/data.csv`, but `https://example.com/dir` + `data.csv` = `https://example.com/data.csv`. If the base has no path (e.g. `https://example.com`), a `/` is inserted: `https://example.com/data.csv`. Dot segments (`./` and `../`) in the relative URL are normalized: `https://example.com/dir/` + `../a.csv` = `https://example.com/a.csv`.
* Host-relative URL (e.g. `/test/data.csv`): resolved against the base URL's scheme and host.
* Scheme-relative URL (e.g. `//other.com/test/data.csv`): resolved using the base URL's scheme.
* Query-only reference (e.g. `?x=1`): appended to the base URL path (replacing any existing query/fragment).
* Fragment-only reference (e.g. `#frag`): appended to the base URL, preserving any query string (replacing any existing fragment).
* Empty reference: returns the base URL without fragment.

For example, if `url_base` is `https://example.com/def/`, then:

* `data.csv` resolves to `https://example.com/def/data.csv`
* `/test/data.csv` resolves to `https://example.com/test/data.csv`
* `//other.com/test/data.csv` resolves to `https://other.com/test/data.csv`

<h2 id="use_async_executor_for_materialized_views">
  use\_async\_executor\_for\_materialized\_views
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.12"},{"label": "0"},{"label": "New setting."}]}]} />

Use async and potentially multithreaded execution of materialized view query, can speedup views processing during INSERT, but also consume more memory.

<h2 id="use_cache_for_count_from_files">
  use\_cache\_for\_count\_from\_files
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Enables caching of rows number during count from files in table functions `file`/`s3`/`url`/`hdfs`/`azureBlobStorage`.

Enabled by default.

<h2 id="use_client_time_zone">
  use\_client\_time\_zone
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Use client timezone for interpreting DateTime string values, instead of adopting server timezone.

<h2 id="use_compact_format_in_distributed_parts_names">
  use\_compact\_format\_in\_distributed\_parts\_names
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.1"},{"label": "1"},{"label": "Use compact format for async INSERT into Distributed tables by default"}]}]} />

Uses compact format for storing blocks for background (`distributed_foreground_insert`) INSERT into tables with `Distributed` engine.

Possible values:

* 0 — Uses `user[:password]@host:port#default_database` directory format.
* 1 — Uses `[shard{shard_index}[_replica{replica_index}]]` directory format.

<Note>
  - with `use_compact_format_in_distributed_parts_names=0` changes from cluster definition will not be applied for background INSERT.
  - with `use_compact_format_in_distributed_parts_names=1` changing the order of the nodes in the cluster definition, will change the `shard_index`/`replica_index` so be aware.
</Note>

<h2 id="use_concurrency_control">
  use\_concurrency\_control
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.12"},{"label": "1"},{"label": "Enable concurrency control by default"}]}]} />

Respect the server's concurrency control (see the `concurrent_threads_soft_limit_num` and `concurrent_threads_soft_limit_ratio_to_cores` global server settings). If disabled, it allows using a larger number of threads even if the server is overloaded (not recommended for normal usage, and needed mostly for tests).

Cloud default value: `0`.

<h2 id="use_hash_table_stats_for_join_reordering">
  use\_hash\_table\_stats\_for\_join\_reordering
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "1"},{"label": "New setting. Previously mirrored 'collect_hash_table_stats_during_joins' setting."}]}]} />

Enable using collected hash table statistics for cardinality estimation during join reordering

<h2 id="use_hedged_requests">
  use\_hedged\_requests
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "21.9"},{"label": "1"},{"label": "Enable Hedged Requests feature by default"}]}]} />

Enables hedged requests logic for remote queries. It allows to establish many connections with different replicas for query.
New connection is enabled in case existent connection(s) with replica(s) were not established within `hedged_connection_timeout`
or no data was received within `receive_data_timeout`. Query uses the first connection which send non empty progress packet (or data packet, if `allow_changing_replica_until_first_data_packet`);
other connections are cancelled. Queries with `max_parallel_replicas > 1` are supported.

Enabled by default.

Cloud default value: `0`.

<h2 id="use_hive_partitioning">
  use\_hive\_partitioning
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "1"},{"label": "Enabled the setting by default."}]}, {"id": "row-2","items": [{"label": "24.8"},{"label": "0"},{"label": "Allows to use hive partitioning for File, URL, S3, AzureBlobStorage and HDFS engines."}]}]} />

When enabled, ClickHouse will detect Hive-style partitioning in path (`/name=value/`) in file-like table engines [File](/reference/functions/table-functions/file#hive-style-partitioning)/[S3](/reference/functions/table-functions/s3#hive-style-partitioning)/[URL](/reference/functions/table-functions/url#hive-style-partitioning)/[HDFS](/reference/functions/table-functions/hdfs#hive-style-partitioning)/[AzureBlobStorage](/reference/functions/table-functions/azureBlobStorage#hive-style-partitioning) and will allow to use partition columns as virtual columns in the query. These virtual columns will have the same names as in the partitioned path, but starting with `_`.

<h2 id="use_iceberg_metadata_files_cache">
  use\_iceberg\_metadata\_files\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "1"},{"label": "New setting"}]}]} />

If turned on, iceberg table function and iceberg storage may utilize the iceberg metadata files cache.

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="use_iceberg_partition_pruning">
  use\_iceberg\_partition\_pruning
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "1"},{"label": "Enable Iceberg partition pruning by default."}]}, {"id": "row-2","items": [{"label": "25.1"},{"label": "0"},{"label": "New setting for Iceberg partition pruning."}]}]} />

Use Iceberg partition pruning for Iceberg tables

<h2 id="use_index_for_in_with_subqueries">
  use\_index\_for\_in\_with\_subqueries
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Try using an index if there is a subquery or a table expression on the right side of the IN operator.

<h2 id="use_index_for_in_with_subqueries_max_values">
  use\_index\_for\_in\_with\_subqueries\_max\_values
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

The maximum size of the set in the right-hand side of the IN operator to use table index for filtering. It allows to avoid performance degradation and higher memory usage due to the preparation of additional data structures for large queries. Zero means no limit.

<h2 id="use_join_disjunctions_push_down">
  use\_join\_disjunctions\_push\_down
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "1"},{"label": "Enabled this optimization."}]}, {"id": "row-2","items": [{"label": "25.10"},{"label": "0"},{"label": "New setting."}]}]} />

Enable pushing OR-connected parts of JOIN conditions down to the corresponding input sides ("partial pushdown").
This allows storage engines to filter earlier, which can reduce data read.
The optimization is semantics-preserving and is applied only when each top-level OR branch contributes at least one deterministic
predicate for the target side.

<h2 id="use_legacy_to_time">
  use\_legacy\_to\_time
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "1"},{"label": "New setting. Allows for user to use the old function logic for toTime, which works as toTimeWithFixedDate."}]}]} />

When enabled, allows to use legacy toTime function, which converts a date with time to a certain fixed date, while preserving the time.
Otherwise, uses a new toTime function, that converts different type of data into the Time type.
The old legacy function is also unconditionally accessible as toTimeWithFixedDate.

<h2 id="use_lightweight_primary_key_index_analysis">
  use\_lightweight\_primary\_key\_index\_analysis
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "1"},{"label": "New setting to optimize primary key index analysis for tables with long primary keys"}]}]} />

Optimize primary key index analysis for `MergeTree` tables with long primary keys.

When enabled, the run time of index analysis mainly depends on the complexity of the query's filter (the key columns it actually uses), not on the length of the primary key — so extending the sorting key has negligible extra overhead on index analysis for queries that filter on only a few of its columns.

Possible values:

* 0 — Disabled. All primary key columns are processed during index analysis.
* 1 — Enabled.

<h2 id="use_page_cache_for_disks_without_file_cache">
  use\_page\_cache\_for\_disks\_without\_file\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "0"},{"label": "Added userspace page cache"}]}]} />

Use userspace page cache for remote disks that don't have filesystem cache enabled.

<h2 id="use_page_cache_for_local_disks">
  use\_page\_cache\_for\_local\_disks
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "New setting to use userspace page cache for local disks"}]}]} />

Use userspace page cache when reading from local disks. Used for testing, unlikely to improve performance in practice. Requires local\_filesystem\_read\_method = 'pread' or 'read'. Doesn't disable the OS page cache; min\_bytes\_to\_use\_direct\_io can be used for that. Only affects regular tables, not file() table function or File() table engine.

<h2 id="use_page_cache_for_object_storage">
  use\_page\_cache\_for\_object\_storage
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "0"},{"label": "New setting to use userspace page cache for object storage table functions"}]}]} />

Use userspace page cache when reading from object storage table functions (s3, azure, hdfs) and table engines (S3, Azure, HDFS).

<h2 id="use_page_cache_with_distributed_cache">
  use\_page\_cache\_with\_distributed\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.3"},{"label": "0"},{"label": "New setting"}]}]} />

Use userspace page cache when distributed cache is used.

<h2 id="use_paimon_partition_pruning">
  use\_paimon\_partition\_pruning
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "0"},{"label": "New setting."}]}]} />

Use Paimon partition pruning for Paimon table functions

<h2 id="use_parquet_metadata_cache">
  use\_parquet\_metadata\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "1"},{"label": "Enables cache of parquet file metadata."}]}]} />

If turned on, parquet format may utilize the parquet metadata cache.

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="use_partition_pruning">
  use\_partition\_pruning
</h2>

**Aliases**: `use_partition_key`

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "1"},{"label": "New setting controlling whether MergeTree uses partition key for pruning. 'use_partition_key' is an alias for this setting."}]}]} />

Use partition key to prune partitions during query execution for MergeTree tables.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_primary_key">
  use\_primary\_key
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "1"},{"label": "New setting controlling whether MergeTree uses the primary key for granule-level pruning."}]}]} />

Use the primary key to prune granules during query execution for MergeTree tables.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_query_cache">
  use\_query\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

If turned on, `SELECT` queries may utilize the [query cache](/concepts/features/performance/caches/query-cache). Parameters [enable\_reads\_from\_query\_cache](#enable_reads_from_query_cache)
and [enable\_writes\_to\_query\_cache](#enable_writes_to_query_cache) control in more detail how the cache is used.

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="use_query_condition_cache">
  use\_query\_condition\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.4"},{"label": "1"},{"label": "A new optimization"}]}, {"id": "row-2","items": [{"label": "25.3"},{"label": "0"},{"label": "New setting."}]}]} />

Enable the [query condition cache](/concepts/features/performance/caches/query-condition-cache). The cache stores ranges of granules in data parts which do not satisfy the condition in the `WHERE` clause,
and reuse this information as an ephemeral index for subsequent queries.

Possible values:

* 0 - Disabled
* 1 - Enabled

<h2 id="use_reader_executor">
  use\_reader\_executor
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "0"},{"label": "New experimental setting to route reads through the new pipeline ReaderExecutor instead of the legacy matryoshka of read buffers."}]}]} />

Experimental. Route reads through the new pipeline `ReaderExecutor` instead of the legacy matryoshka of read buffers. Falls back to the legacy path for configurations the executor does not yet support.

<h2 id="use_roaring_bitmap_iceberg_positional_deletes">
  use\_roaring\_bitmap\_iceberg\_positional\_deletes
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "0"},{"label": "New setting"}]}]} />

Use roaring bitmap for iceberg positional deletes.

<h2 id="use_skip_indexes">
  use\_skip\_indexes
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

Use data skipping indexes during query execution.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_skip_indexes_for_disjunctions">
  use\_skip\_indexes\_for\_disjunctions
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "1"},{"label": "New setting"}]}]} />

Evaluate WHERE filters with mixed AND and OR conditions using skip indexes. Example: WHERE A = 5 AND (B = 5 OR C = 5).
If disabled, skip indexes are still used to evaluate WHERE conditions but they must only contain AND-ed clauses.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_skip_indexes_for_top_k">
  use\_skip\_indexes\_for\_top\_k
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1"},{"label": "Enable using data skipping indexes for TopK filtering by default"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "0"},{"label": "New setting."}]}]} />

Enable using data skipping indexes for TopK filtering.

When enabled, if a minmax skip index exists on the column in `ORDER BY <column> LIMIT n` query, optimizer will attempt to use the minmax index to skip granules that are not relevant for the final result . This can reduce query latency.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_skip_indexes_if_final">
  use\_skip\_indexes\_if\_final
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "1"},{"label": "Change in default value of setting"}]}]} />

Controls whether skipping indexes are used when executing a query with the FINAL modifier.

Skip indexes may exclude rows (granules) containing the latest data, which could lead to incorrect results from a query with the FINAL modifier. When this setting is enabled, skipping indexes are applied even with the FINAL modifier, potentially improving performance but with the risk of missing recent updates. This setting should be enabled in sync with the setting use\_skip\_indexes\_if\_final\_exact\_mode (default is enabled).

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_skip_indexes_if_final_exact_mode">
  use\_skip\_indexes\_if\_final\_exact\_mode
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.6"},{"label": "1"},{"label": "Change in default value of setting"}]}, {"id": "row-2","items": [{"label": "25.5"},{"label": "0"},{"label": "This setting was introduced to help FINAL query return correct results with skip indexes"}]}]} />

Controls whether granules returned by a skipping index are expanded in newer parts to return correct results when executing a query with the FINAL modifier.

Using skip indexes may exclude rows (granules) containing the latest data which could lead to incorrect results. This setting can ensure that correct results are returned by scanning newer parts that have overlap with the ranges returned by the skip index. This setting should be disabled only if approximate results based on looking up the skip index are okay for an application.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_skip_indexes_on_data_read">
  use\_skip\_indexes\_on\_data\_read
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "The text index is now GA"}]}, {"id": "row-2","items": [{"label": "26.1"},{"label": "1"},{"label": "Default enable"}]}, {"id": "row-3","items": [{"label": "25.9"},{"label": "0"},{"label": "New setting"}]}]} />

Enable using data skipping indexes during data reading.

When enabled, skip indexes are evaluated dynamically at the time each data granule is being read, rather than being analyzed in advance before query execution begins. This can reduce query startup latency.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_statistics">
  use\_statistics
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "1"},{"label": "Enable this optimization by default."}]}]} />

/// preferred over 'allow\_statistics\_optimize' because of consistency with 'use\_primary\_key' and 'use\_skip\_indexes'
Allows using statistics to optimize queries

<h2 id="use_statistics_cache">
  use\_statistics\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.2"},{"label": "1"},{"label": "Enable statistics cache"}]}, {"id": "row-2","items": [{"label": "25.11"},{"label": "0"},{"label": "New setting"}]}]} />

Use statistics cache in a query to avoid the overhead of loading statistics of every parts

<h2 id="use_statistics_for_part_pruning">
  use\_statistics\_for\_part\_pruning
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1"},{"label": "New setting to use statistics for part pruning during query execution."}]}]} />

Use statistics to filter out parts during query execution.

When enabled, pruning in SELECT queries will use column statistics (e.g. MinMax statistics) to eliminate parts that cannot contain matching data before reading any data.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_strict_insert_block_limits">
  use\_strict\_insert\_block\_limits
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "0"},{"label": "New setting to use strict min and max insert bounds on inserts. When min < max, max limits take precedence."}]}]} />

When enabled, strictly enforces both minimum and maximum insert block size limits.

A block is emitted when:

* Min thresholds (AND): Both min\_insert\_block\_size\_rows AND min\_insert\_block\_size\_bytes are reached.
* Max thresholds (OR): Either max\_insert\_block\_size\_rows OR max\_insert\_block\_size\_bytes is reached.

When disabled, a block is emitted when:

* Min thresholds (OR):  min\_insert\_block\_size\_rows OR min\_insert\_block\_size\_bytes is reached.

**Note**: If max settings are smaller than min settings, the max limits take precedence and blocks will be emitted before min thresholds are reached.

**Note**: This setting is automatically disabled for async inserts, because async inserts attach per-entry deduplication tokens that are incompatible with block splitting that is needed for enforcement of strict limits.

Disabled by default.

<h2 id="use_structure_from_insertion_table_in_table_functions">
  use\_structure\_from\_insertion\_table\_in\_table\_functions
</h2>

<SettingsInfoBlock type="UInt64" default_value="2" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.11"},{"label": "2"},{"label": "Improve using structure from insertion table in table functions"}]}]} />

Use structure from insertion table instead of schema inference from data. Possible values: 0 - disabled, 1 - enabled, 2 - auto

<h2 id="use_text_index_header_cache">
  use\_text\_index\_header\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "0"},{"label": "New setting"}]}]} />

Whether to use a cache of deserialized text index header.
Using the text index header cache can significantly reduce latency and increase throughput when working with a large number of text index queries.

<h2 id="use_text_index_like_evaluation_by_dictionary_scan">
  use\_text\_index\_like\_evaluation\_by\_dictionary\_scan
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1"},{"label": "New setting"}]}]} />

Enable evaluation of LIKE/ILIKE queries by scanning the inverted text index dictionary.

<h2 id="use_text_index_postings_cache">
  use\_text\_index\_postings\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "0"},{"label": "New setting"}]}]} />

Whether to use a cache of deserialized text index posting lists.
Using the text index postings cache can significantly reduce latency and increase throughput when working with a large number of text index queries.

<h2 id="use_text_index_tokens_cache">
  use\_text\_index\_tokens\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "New setting"}]}]} />

Whether to use a cache of deserialized text index token infos.
Using the text index tokens cache can significantly reduce latency and increase throughput when working with a large number of text index queries.

<h2 id="use_top_k_dynamic_filtering">
  use\_top\_k\_dynamic\_filtering
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "1"},{"label": "Enable dynamic filtering optimization for TopK queries by default"}]}, {"id": "row-2","items": [{"label": "25.12"},{"label": "0"},{"label": "New setting."}]}]} />

Enable dynamic filtering optimization when executing a `ORDER BY <column> LIMIT n` query.

When enabled, the query executor will try to skip granules and rows that will not be part of the final `top N` rows in the resultset. This optimization is dynamic in nature and latency improvements depends on data distribution and presence of other predicates in the query.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_top_k_dynamic_filtering_for_variable_length_types">
  use\_top\_k\_dynamic\_filtering\_for\_variable\_length\_types
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": "0"},{"label": "Disable `use_top_k_dynamic_filtering` for variable-length sort columns (e.g. `String`) by default; the previous behavior had the optimization apply unconditionally and is preserved under `compatibility`."}]}]} />

Allow `use_top_k_dynamic_filtering` to apply when the sort column has a variable-length data type (e.g. `String`, `Array`, `Map`, `Tuple` containing variable-length elements).

For such types, the per-row threshold comparison performed by the dynamic filter can outweigh its savings when the column's lexicographic minimum dominates (e.g. mostly empty strings) and few granules can be skipped. In that case the dynamic filter degrades query latency rather than improving it.

When this setting is `0`, dynamic filtering is restricted to columns whose values have a fixed maximum size in memory (numbers, `Date`, `DateTime`, `FixedString`, `Enum`, `Nullable` of such types, `Tuple` of such types). When set to `1`, dynamic filtering applies to variable-length types as well.

Possible values:

* 0 — Disabled.
* 1 — Enabled.

<h2 id="use_uncompressed_cache">
  use\_uncompressed\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Whether to use a cache of uncompressed blocks. Accepts 0 or 1. By default, 0 (disabled).
Using the uncompressed cache (only for tables in the MergeTree family) can significantly reduce latency and increase throughput when working with a large number of short queries. Enable this setting for users who send frequent short requests. Also pay attention to the [uncompressed\_cache\_size](/reference/settings/server-settings/settings#uncompressed_cache_size) configuration parameter (only set in the config file) – the size of uncompressed cache blocks. By default, it is 8 GiB. The uncompressed cache is filled in as needed and the least-used data is automatically deleted.

For queries that read at least a somewhat large volume of data (one million rows or more), the uncompressed cache is disabled automatically to save space for truly small queries. This means that you can keep the 'use\_uncompressed\_cache' setting always set to 1.

<h2 id="use_variant_as_common_type">
  use\_variant\_as\_common\_type
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "1"},{"label": "Improves usability."}]}, {"id": "row-2","items": [{"label": "24.1"},{"label": "0"},{"label": "Allow to use Variant in if/multiIf if there is no common type"}]}]} />

Allows to use `Variant` type as a result type for [if](/reference/functions/regular-functions/conditional-functions#if)/[multiIf](/reference/functions/regular-functions/conditional-functions#multiIf)/[array](/reference/functions/regular-functions/array-functions)/[map](/reference/functions/regular-functions/tuple-map-functions) functions when there is no common type for argument types.

Example:

```sql theme={null}
SET use_variant_as_common_type = 1;
SELECT toTypeName(if(number % 2, number, range(number))) as variant_type FROM numbers(1);
SELECT if(number % 2, number, range(number)) as variant FROM numbers(5);
```

```text theme={null}
┌─variant_type───────────────────┐
│ Variant(Array(UInt64), UInt64) │
└────────────────────────────────┘
┌─variant───┐
│ []        │
│ 1         │
│ [0,1]     │
│ 3         │
│ [0,1,2,3] │
└───────────┘
```

```sql theme={null}
SET use_variant_as_common_type = 1;
SELECT toTypeName(multiIf((number % 4) = 0, 42, (number % 4) = 1, [1, 2, 3], (number % 4) = 2, 'Hello, World!', NULL)) AS variant_type FROM numbers(1);
SELECT multiIf((number % 4) = 0, 42, (number % 4) = 1, [1, 2, 3], (number % 4) = 2, 'Hello, World!', NULL) AS variant FROM numbers(4);
```

```text theme={null}
─variant_type─────────────────────────┐
│ Variant(Array(UInt8), String, UInt8) │
└──────────────────────────────────────┘

┌─variant───────┐
│ 42            │
│ [1,2,3]       │
│ Hello, World! │
│ ᴺᵁᴸᴸ          │
└───────────────┘
```

```sql theme={null}
SET use_variant_as_common_type = 1;
SELECT toTypeName(array(range(number), number, 'str_' || toString(number))) as array_of_variants_type from numbers(1);
SELECT array(range(number), number, 'str_' || toString(number)) as array_of_variants FROM numbers(3);
```

```text theme={null}
┌─array_of_variants_type────────────────────────┐
│ Array(Variant(Array(UInt64), String, UInt64)) │
└───────────────────────────────────────────────┘

┌─array_of_variants─┐
│ [[],0,'str_0']    │
│ [[0],1,'str_1']   │
│ [[0,1],2,'str_2'] │
└───────────────────┘
```

```sql theme={null}
SET use_variant_as_common_type = 1;
SELECT toTypeName(map('a', range(number), 'b', number, 'c', 'str_' || toString(number))) as map_of_variants_type from numbers(1);
SELECT map('a', range(number), 'b', number, 'c', 'str_' || toString(number)) as map_of_variants FROM numbers(3);
```

```text theme={null}
┌─map_of_variants_type────────────────────────────────┐
│ Map(String, Variant(Array(UInt64), String, UInt64)) │
└─────────────────────────────────────────────────────┘

┌─map_of_variants───────────────┐
│ {'a':[],'b':0,'c':'str_0'}    │
│ {'a':[0],'b':1,'c':'str_1'}   │
│ {'a':[0,1],'b':2,'c':'str_2'} │
└───────────────────────────────┘
```

<h2 id="use_variant_default_implementation_for_comparisons">
  use\_variant\_default\_implementation\_for\_comparisons
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.1"},{"label": "1"},{"label": "Enable default implementation for Variant type in comparison functions"}]}]} />

Enables or disables default implementation for Variant type in comparison functions.

<h2 id="use_with_fill_by_sorting_prefix">
  use\_with\_fill\_by\_sorting\_prefix
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.5"},{"label": "1"},{"label": "Columns preceding WITH FILL columns in ORDER BY clause form sorting prefix. Rows with different values in sorting prefix are filled independently"}]}]} />

Columns preceding WITH FILL columns in ORDER BY clause form sorting prefix. Rows with different values in sorting prefix are filled independently

<h2 id="validate_enum_literals_in_operators">
  validate\_enum\_literals\_in\_operators
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "0"},{"label": "A new setting"}]}]} />

If enabled, validate enum literals in operators like `IN`, `NOT IN`, `==`, `!=` against the enum type and throw an exception if the literal is not a valid enum value.

<h2 id="validate_mutation_query">
  validate\_mutation\_query
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "1"},{"label": "New setting to validate mutation queries by default."}]}]} />

Validate mutation queries before accepting them. Mutations are executed in the background, and running an invalid query will cause mutations to get stuck, requiring manual intervention.

Only change this setting if you encounter a backward-incompatible bug.

<h2 id="validate_polygons">
  validate\_polygons
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "20.4"},{"label": "1"},{"label": "Throw exception if polygon is invalid in function pointInPolygon by default instead of returning possibly wrong results"}]}]} />

Enables or disables throwing an exception in the [pointInPolygon](/reference/functions/regular-functions/geo/coordinates#pointinpolygon) function, if the polygon is self-intersecting or self-tangent.

Possible values:

* 0 — Throwing an exception is disabled. `pointInPolygon` accepts invalid polygons and returns possibly incorrect results for them.
* 1 — Throwing an exception is enabled.

<h2 id="variant_throw_on_type_mismatch">
  variant\_throw\_on\_type\_mismatch
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.4"},{"label": "1"},{"label": "New setting to control type mismatch behavior in default Variant implementation"}]}]} />

When applying a function to a [Variant](/reference/data-types/variant) column using the default implementation,
controls what happens for rows whose actual type is incompatible with the function:

* `true` (default) — throw an exception.
* `false` — return `NULL` for those rows instead.

<h2 id="vector_search_filter_strategy">
  vector\_search\_filter\_strategy
</h2>

<SettingsInfoBlock type="VectorSearchFilterStrategy" default_value="auto" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.5"},{"label": "auto"},{"label": "New setting"}]}]} />

If a vector search query has a WHERE clause, this setting determines if it is evaluated first (pre-filtering) OR if the vector similarity index is checked first (post-filtering). Possible values:

* 'auto' - Postfiltering (the exact semantics may change in future).
* 'postfilter' - Use vector similarity index to identify the nearest neighbours, then apply other filters
* 'prefilter' - Evaluate other filters first, then perform brute-force search to identify neighbours.

<h2 id="vector_search_index_fetch_multiplier">
  vector\_search\_index\_fetch\_multiplier
</h2>

**Aliases**: `vector_search_postfilter_multiplier`

<SettingsInfoBlock type="Float" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "1"},{"label": "Alias for setting 'vector_search_postfilter_multiplier'"}]}]} />

Multiply the number of fetched nearest neighbors from the vector similarity index by this number. Only applied for post-filtering with other predicates or if setting 'vector\_search\_with\_rescoring = 1'.

<h2 id="vector_search_with_rescoring">
  vector\_search\_with\_rescoring
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "0"},{"label": "New setting."}]}]} />

If ClickHouse performs rescoring for queries that use the vector similarity index.
Without rescoring, the vector similarity index returns the rows containing the best matches directly.
With rescoring, the rows are extrapolated to granule level and all rows in the granule are checked again.
In most situations, rescoring helps only marginally with accuracy but it deteriorates performance of vector search queries significantly.
Note: A query run without rescoring and with parallel replicas enabled may fall back to rescoring.

<h2 id="wait_changes_become_visible_after_commit_mode">
  wait\_changes\_become\_visible\_after\_commit\_mode
</h2>

<SettingsInfoBlock type="TransactionsWaitCSNMode" default_value="wait_unknown" />

Wait for committed changes to become actually visible in the latest snapshot

<h2 id="wait_for_async_insert">
  wait\_for\_async\_insert
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

If true wait for processing of asynchronous insertio

<h2 id="wait_for_async_insert_timeout">
  wait\_for\_async\_insert\_timeout
</h2>

<SettingsInfoBlock type="Seconds" default_value="120" />

Timeout for waiting for processing asynchronous insertio

<h2 id="wait_for_part_commit_in_dependent_materialized_views">
  wait\_for\_part\_commit\_in\_dependent\_materialized\_views
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.6"},{"label": "0"},{"label": "New setting"}]}]} />

Controls whether each sink commits its just-written part before its own dependent materialized view cascade runs, so a cascade that reads back from the source via `JOIN` observes the part written by that sink.

The guarantee is per sink instance — parts written by other sink threads of the same `INSERT` may not yet be visible. The setting does not provide cross-thread commit ordering.

Has no effect on inserts into tables with no dependent materialized views.

<h2 id="wait_for_window_view_fire_signal_timeout">
  wait\_for\_window\_view\_fire\_signal\_timeout
</h2>

<SettingsInfoBlock type="Seconds" default_value="10" />

Timeout for waiting for window view fire signal in event time processing

<h2 id="webassembly_udf_max_fuel">
  webassembly\_udf\_max\_fuel
</h2>

<SettingsInfoBlock type="UInt64" default_value="100000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "100000"},{"label": "New setting to limit CPU instructions (fuel) per WebAssembly UDF instance execution."}]}]} />

Fuel limit per WebAssembly UDF instance execution. Each WebAssembly instruction consumes some amount of fuel. The value is scaled by 1024 before being passed to the runtime, so `webassembly_udf_max_fuel = 1` corresponds to approximately 1024 fuel units. Set to 0 for no finite limit. Applies only to functions whose per-function setting `webassembly_udf_enable_fuel` is true, which is the default.

<h2 id="webassembly_udf_max_input_block_size">
  webassembly\_udf\_max\_input\_block\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "0"},{"label": "New setting to limit input block size for WebAssembly UDFs."}]}]} />

Maximum number of rows passed to a WebAssembly UDF in a single block. Set to 0 to process all rows at once.

<h2 id="webassembly_udf_max_instances">
  webassembly\_udf\_max\_instances
</h2>

<SettingsInfoBlock type="UInt64" default_value="32" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "32"},{"label": "New setting to limit the number of parallel WebAssembly UDF instances per function."}]}]} />

Maximum number of WebAssembly UDF instances that can run in parallel per function.

<h2 id="webassembly_udf_max_memory">
  webassembly\_udf\_max\_memory
</h2>

<SettingsInfoBlock type="UInt64" default_value="134217728" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "134217728"},{"label": "New setting to limit memory per WebAssembly UDF instance."}]}]} />

Memory limit in bytes per WebAssembly UDF instance.

<h2 id="window_view_clean_interval">
  window\_view\_clean\_interval
</h2>

<SettingsInfoBlock type="Seconds" default_value="60" />

The clean interval of window view in seconds to free outdated data.

<h2 id="window_view_heartbeat_interval">
  window\_view\_heartbeat\_interval
</h2>

<SettingsInfoBlock type="Seconds" default_value="15" />

The heartbeat interval in seconds to indicate watch query is alive.

<h2 id="workload">
  workload
</h2>

<SettingsInfoBlock type="String" default_value="default" />

Name of workload to be used to access resources

<h2 id="write_full_path_in_iceberg_metadata">
  write\_full\_path\_in\_iceberg\_metadata
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.8"},{"label": "0"},{"label": "New setting."}]}]} />

Write full paths (including s3://) into iceberg metadata files.

<h2 id="write_through_distributed_cache">
  write\_through\_distributed\_cache
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": "0"},{"label": "A setting for ClickHouse Cloud"}]}]} />

Only has an effect in ClickHouse Cloud. Allow writing to distributed cache (writing to s3 will also be done by distributed cache)

<h2 id="write_through_distributed_cache_buffer_size">
  write\_through\_distributed\_cache\_buffer\_size
</h2>

<SettingsInfoBlock type="UInt64" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.7"},{"label": "0"},{"label": "New cloud setting"}]}]} />

Only has an effect in ClickHouse Cloud. Set buffer size for write-through distributed cache. If 0, will use buffer size which would have been used if there was not distributed cache.

<h2 id="zstd_window_log_max">
  zstd\_window\_log\_max
</h2>

<SettingsInfoBlock type="Int64" default_value="0" />

Allows you to select the max window log of ZSTD (it will not be used for MergeTree family)
