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

# background_* 服务器设置

> background_* 自动生成分组中的 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>;
};

这些设置用于配置 ClickHouse 服务器，由 ClickHouse 源代码自动生成。

<div id="background_buffer_flush_schedule_pool_size">
  ## background\_buffer\_flush\_schedule\_pool\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="16" changeable_without_restart="仅可增加" />在后台对 [Buffer 引擎表](/docs/zh/reference/engines/table-engines/special/buffer) 执行刷盘操作时可使用的最大线程数。

<div id="background_common_pool_size">
  ## background\_common\_pool\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="8" changeable_without_restart="No" />用于在后台为 [\*MergeTree-engine](/docs/zh/reference/engines/table-engines/mergetree-family/index) 表执行各种操作 (主要是垃圾回收) 的最大线程数。

<div id="background_distributed_schedule_pool_size">
  ## background\_distributed\_schedule\_pool\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="16" changeable_without_restart="仅可增加" />用于执行分布式发送操作的最大线程数。

<div id="background_fetches_pool_size">
  ## background\_fetches\_pool\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="16" changeable_without_restart="No" />用于在后台从另一个副本拉取 [\*MergeTree-engine](/docs/zh/reference/engines/table-engines/mergetree-family/index) 表的数据分区片段时，可使用的最大线程数。

<div id="background_message_broker_schedule_pool_size">
  ## background\_message\_broker\_schedule\_pool\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="16" changeable_without_restart="仅可增加" />用于执行消息流处理后台操作的最大线程数。

<div id="background_move_pool_size">
  ## background\_move\_pool\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="8" changeable_without_restart="No" />后台将 \*MergeTree 引擎表的数据分区片段移动到其他磁盘或卷时可使用的最大线程数。

<div id="background_pool_size">
  ## background\_pool\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="16" changeable_without_restart="No" />

设置用于执行 MergeTree 引擎表后台合并和变更的线程数。

<Note>
  * 出于向后兼容考虑，也可以在 ClickHouse 服务器 启动时通过 `default` profile 配置应用此设置。
  * 你只能在运行时增加线程数。
  * 若要减少线程数，则必须重启 ClickHouse 服务器。
  * 通过调整此设置，你可以管理 CPU 和磁盘负载。
</Note>

<Danger>
  较小的线程池大小会占用更少的 CPU 和磁盘资源，但后台进程推进得也更慢，最终可能会影响查询性能。
</Danger>

在更改此设置之前，也请查看相关的 MergeTree settings，例如：

* [`number_of_free_entries_in_pool_to_lower_max_size_of_merge`](/docs/zh/reference/settings/merge-tree-settings/number-of#number_of_free_entries_in_pool_to_lower_max_size_of_merge)。
* [`number_of_free_entries_in_pool_to_execute_mutation`](/docs/zh/reference/settings/merge-tree-settings/number-of#number_of_free_entries_in_pool_to_execute_mutation)。
* [`number_of_free_entries_in_pool_to_execute_optimize_entire_partition`](/docs/zh/reference/settings/merge-tree-settings/number-of#number_of_free_entries_in_pool_to_execute_optimize_entire_partition)

**示例**

```xml theme={null}
<background_pool_size>16</background_pool_size>
```

<div id="background_streaming_schedule_pool_size">
  ## background\_streaming\_schedule\_pool\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="16" changeable_without_restart="仅可增加" />用于执行流式后台操作的最大线程数。
