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

# max_insert_* session settings

> ClickHouse session settings in the max_insert_* 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>;
};

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="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`](/docs/reference/settings/session-settings/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.
