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

# Other session settings

> ClickHouse session settings in the Other generated group.

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

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

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/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/docs/beta-and-experimental-features#experimental-features">Learn more.</a></u>
        </div>;
};

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

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

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

Write add http CORS header.

<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_inline_views">
  analyzer\_inline\_views
</h2>

<ExperimentalBadge />

<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](/docs/reference/statements/select/join#settings)

<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="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>

<CloudOnlyBadge />

<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](/docs/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="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="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="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="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](/docs/reference/statements/create/table#null-or-not-null-modifiers) in column definition will be [Nullable](/docs/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="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](/docs/concepts/features/operations/insert/deduplicating-inserts-on-retries#insert-deduplication-with-materialized-views)

<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="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="dialect">
  dialect
</h2>

<SettingsInfoBlock type="Dialect" default_value="clickhouse" />

Which dialect will be used to parse query

<h2 id="discard_query_data">
  discard\_query\_data
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "0"},{"label": "New setting to skip sending query result rows to the client over the native TCP protocol."}]}]} />

If enabled, the server skips sending query result rows to the client. The query is still executed and logged fully on the server, and the client still receives the remaining packets.

Used for shadow traffic, benchmarks, and fuzzing.

Has no effect for secondary queries.

Affects only the native TCP protocol.

<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="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_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](/docs/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="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_url_skip_empty_files">
  engine\_url\_skip\_empty\_files
</h2>

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

Enables or disables skipping empty files in [URL](/docs/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](/docs/reference/settings/merge-tree-settings#materialize_skip_indexes_on_merge) or by an explicit
[MATERIALIZE INDEX](/docs/reference/statements/alter/skipping-index#materialize-index) query.

Has no effect if [materialize\_skip\_indexes\_on\_insert](/docs/reference/settings/session-settings/materialize#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="explain_query_plan_default">
  explain\_query\_plan\_default
</h2>

<SettingsInfoBlock type="ExplainQueryPlanDefault" default_value="pretty" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "pretty"},{"label": "From 26.7, `EXPLAIN PLAN` defaults to `actions=1, compact=1, pretty=1`. Set this to `legacy` to restore the pre-26.7 output."}]}]} />

Default format used by `EXPLAIN PLAN`.

Possible values:

* `pretty` (default since 26.7) — `actions`, `compact`, and `pretty` default to `true`, producing a compact, pretty, action-annotated plan.
* `legacy` — pre-26.7 output.

Specifying the `actions`, `compact`, or `pretty` options explicitly in the `EXPLAIN` statement (for example, `EXPLAIN actions = 0, compact = 0, pretty = 0 SELECT ...`) always overrides this setting.

`EXPLAIN PLAN` with `json = 1` or `distributed = 1` keeps the legacy (pre-26.7) defaults regardless of this setting, unless `actions`, `compact`, or `pretty` are set explicitly. The pretty output cannot represent JSON results or per-shard distributed plans, so those modes are only rendered correctly in legacy form.

<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](/docs/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_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](/docs/reference/statements/select/from#final-modifier) modifier to all tables in a query, to tables where [FINAL](/docs/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](/docs/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="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="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>

<BetaBadge />

<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="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="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](/docs/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="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="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="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="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="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](/docs/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_marks_asynchronously">
  load\_marks\_asynchronously
</h2>

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

Load MergeTree marks asynchronously

Cloud default value: `1`.

<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="low_priority_query_wait_time_ms">
  low\_priority\_query\_wait\_time\_ms
</h2>

<BetaBadge />

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

<ExperimentalBadge />

<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="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="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="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="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="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](/docs/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="paimon_target_snapshot_id">
  paimon\_target\_snapshot\_id
</h2>

<ExperimentalBadge />

<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="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="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="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>

<ExperimentalBadge />

<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_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="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. Values above 256 MiB are clamped to 256 MiB, as a read buffer never needs to be larger.

<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="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_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](/docs/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](/docs/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="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="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="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_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](/docs/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_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="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`](/docs/reference/statements/alter/index), [`OPTIMIZE`](/docs/reference/statements/optimize) or [`TRUNCATE`](/docs/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="reserve_memory">
  reserve\_memory
</h2>

<ExperimentalBadge />

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "0"},{"label": "New setting to reserve memory for specific workload before starting a query."}]}]} />

Used in workload scheduling. The minimum amount of RAM reserved to be used for running a query on a single server. Reservation is made through the WORKLOAD hierarchy using the value of a `workload` query setting.
If not enough memory is available to the workload, a query is prevented from starting and waits in pending state until the reservation can be fulfilled.
A value of `0` means no reservation.
This setting takes effect only if MEMORY RESERVATION resource is created.

<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" />

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`](/docs/reference/settings/session-settings/max-result#max_result_rows), multiple of [`max_block_size`](/docs/reference/settings/session-settings/max#max_block_size)
and depends on [`max_threads`](/docs/reference/settings/session-settings/max-threads#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="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="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](/docs/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](/docs/reference/settings/session-settings/insert-quorum#insert_quorum)
* [insert\_quorum\_timeout](/docs/reference/settings/session-settings/insert-quorum#insert_quorum_timeout)
* [insert\_quorum\_parallel](/docs/reference/settings/session-settings/insert-quorum#insert_quorum_parallel)

<h2 id="session_timezone">
  session\_timezone
</h2>

<BetaBadge />

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](/docs/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](/docs/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="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="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="snappy_mode">
  snappy\_mode
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "basic"},{"label": "New setting to control the wire format used for snappy compression in generic file\/URL I\/O. The default `basic` preserves backward-compatible Hadoop snappy block format reads; HTTP `Content-Encoding: snappy` always uses the framing format independently of this setting."}]}]} />

Controls the wire format used for snappy compression for generic file I/O paths such as `file` and `url`. HTTP `Content-Encoding: snappy` always uses the framing format and ignores this setting.

Note that the raw snappy block format produced by a single `snappy::Compress` call (for example, the Prometheus remote protocol payloads handled by `SnappyBasicReadBuffer`) is a separate, protocol-specific wire format and is not controlled by this setting.

Possible values:

* `basic` — Hadoop snappy block format. Compatible with files read and written by Hadoop. Supports both reading and writing.
* `framed` — Snappy framing format, the standard streaming format defined by Google. Supports both reading and writing.

<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="splitby_max_substrings_includes_remaining_string">
  splitby\_max\_substrings\_includes\_remaining\_string
</h2>

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

Controls whether function [splitBy\*()](/docs/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/latest/api/python/reference/pyspark.sql/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>

<ExperimentalBadge />

<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="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="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`](/docs/concepts/features/interfaces/cli) or using the [gRPC interface](/docs/concepts/features/interfaces/grpc).

<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="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](/docs/reference/syntax#null) values for [IN](/docs/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](/docs/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](/docs/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](/docs/reference/statements/select/union).

<h2 id="unique_key_max_encoded_size">
  unique\_key\_max\_encoded\_size
</h2>

<ExperimentalBadge />

<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="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](/docs/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="wait_changes_become_visible_after_commit_mode">
  wait\_changes\_become\_visible\_after\_commit\_mode
</h2>

<ExperimentalBadge />

<SettingsInfoBlock type="TransactionsWaitCSNMode" default_value="wait_unknown" />

Wait for committed changes to become actually visible in the latest snapshot

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

<ExperimentalBadge />

<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="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)
