Skip to main content
These settings are available in system.settings and are autogenerated from source.

max_temporary_columns

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.
This setting is useful for preventing overly complex queries.
0 value means unlimited.

max_temporary_data_on_disk_size_for_query

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)

max_temporary_data_on_disk_size_for_user

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)

max_temporary_non_const_columns

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.
Constant columns are formed fairly often when running a query, but they require approximately zero computing resources.

max_temporary_table_memory_usage

The maximum number of bytes of memory that one temporary table with the Memory engine can hold. It applies to tables created with CREATE TEMPORARY TABLE, including the default temporary table engine (see default_temporary_table_engine), and is counted in the same way as total_bytes in system.tables. The limit is checked on every INSERT into the table (including CREATE TEMPORARY TABLE ... AS SELECT), while the data is being received and again before it is added: if the table would exceed it, the INSERT throws an exception with the TOO_MANY_BYTES error code and the data is not added. An INSERT that writes with several threads (see max_insert_threads) adds the data of every thread separately, so the data of some threads may already be added when another one throws, but the table never exceeds the limit. The value is taken from the settings of the INSERT query. The limit is also checked after a mutation (ALTER TABLE ... UPDATE, MATERIALIZE COLUMN, etc.), with the value from the settings of the ALTER query: if the mutated data would exceed it, the mutation throws an exception with the TOO_MANY_BYTES error code and the data is left unchanged. Note that the max_bytes_to_keep setting of the Memory engine is different: it evicts the oldest data instead of rejecting the new one. If both are set, the eviction is applied first. Possible values:
  • Positive integer.
  • 0 — unlimited (default)

max_temporary_table_size_bytes_compressed

The maximum size in bytes of the data on disk (compressed) of one temporary table with an engine of the MergeTree family. It applies to tables created with CREATE TEMPORARY TABLE and is counted in the same way as total_bytes in system.tables, that is, as the sum of the sizes of the active data parts. The limit is checked on every INSERT into the table (including CREATE TEMPORARY TABLE ... AS SELECT) before each new data part is committed: if the table would exceed it, the INSERT throws an exception with the TOO_MANY_BYTES error code and the part is not added. Parts committed earlier by the same INSERT stay in the table, as with any other error during an INSERT of multiple blocks. The value is taken from the settings of the INSERT query. The operations that add existing parts to the table are limited in the same way, with the value from the settings of their query: ATTACH PART, ATTACH PARTITION, ATTACH PARTITION ... FROM, REPLACE PARTITION ... FROM and CREATE TEMPORARY TABLE ... CLONE AS. They are rejected as a whole, unless they do not increase the size of the table. For ATTACH PARTITION, the check is done once for all its parts before they are attached, so writes running concurrently with it may make the table exceed the limit slightly. The parts written by background merges and mutations (ALTER TABLE ... UPDATE, MATERIALIZE COLUMN, etc.) are not checked, so a mutation that makes the data larger can make the table exceed the limit. Possible values:
  • Positive integer.
  • 0 — unlimited (default)

max_temporary_table_size_bytes_uncompressed

The maximum size in bytes of the uncompressed data of one temporary table with an engine of the MergeTree family. It applies to tables created with CREATE TEMPORARY TABLE and is counted in the same way as total_bytes_uncompressed in system.tables. The limit is checked in the same way as max_temporary_table_size_bytes_compressed. Possible values:
  • Positive integer.
  • 0 — unlimited (default)

max_temporary_tables

The maximum number of temporary tables that can exist in one session at the same time. Only tables created with CREATE TEMPORARY TABLE are counted: tables with external data sent with a query and the temporary tables built internally for GLOBAL IN / GLOBAL JOIN or materialized CTEs are not. The limit is checked when a new temporary table is created, and an exception with the TOO_MANY_TABLES error code is thrown if the session already has this number of temporary tables. Replacing an existing temporary table with CREATE OR REPLACE TEMPORARY TABLE does not increase the number of tables and is always allowed. Possible values:
  • Positive integer.
  • 0 — unlimited (default)
Last modified on October 8, 2026