> ## 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_temporary_* 会话设置

> 属于 max_temporary_* 自动生成组的 ClickHouse 会话设置。

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
  }}>类型</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>默认值</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          无需重启即可更改
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

这些设置可在 [system.settings](/docs/zh/reference/system-tables/settings) 中查看，并由 [源代码](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<div id="max_temporary_columns">
  ## max\_temporary\_columns
</div>

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

运行查询时，必须同时保存在 RAM 中的临时列最大数量，包括常量列。如果查询因中间计算而在内存中生成的临时列数超过指定数量，则会抛出异常。

<Tip>
  此设置有助于防止查询过于复杂。
</Tip>

`0` 表示不受限制。

<div id="max_temporary_data_on_disk_size_for_query">
  ## max\_temporary\_data\_on\_disk\_size\_for\_query
</div>

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

所有并发运行的查询在磁盘上使用的临时 File 的最大总数据量，单位为字节。

可能的值：

* 正整数。
* `0` — 不受限制 (默认)

<div id="max_temporary_data_on_disk_size_for_user">
  ## max\_temporary\_data\_on\_disk\_size\_for\_user
</div>

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

同一用户所有并发运行的查询在 disk 上的临时 File 所占数据量上限，单位为字节。

可能的值：

* 正整数。
* `0` — 不受限制 (默认)

<div id="max_temporary_non_const_columns">
  ## max\_temporary\_non\_const\_columns
</div>

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

与 `max_temporary_columns` 类似，该设置表示执行查询时需要同时保存在 RAM 中的临时列的最大数量，但不包括常量列。

<Note>
  执行查询时经常会生成常量列，但它们几乎不消耗计算资源。
</Note>
