> ## 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_parts_* MergeTree 表设置

> ClickHouse MergeTree 表设置，属于自动生成的 max_parts_* 组。

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.merge\_tree\_settings](/docs/zh/reference/system-tables/merge_tree_settings) 中，由 ClickHouse 源代码自动生成。

<div id="max_parts_in_total">
  ## max\_parts\_in\_total
</div>

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

如果某个表所有分区中的活跃 parts 总数超过
`max_parts_in_total` 的值，`INSERT` 将被中断，并抛出 `Too many parts
(N)` 异常。

可能的值：

* 任意正整数。

表中的 parts 数量过多会降低 ClickHouse 查询性能，
并增加 ClickHouse 启动时间。这通常是由于
设计不当造成的 (例如分区策略选择错误——分区过小) 。

<div id="max_parts_to_merge_at_once">
  ## max\_parts\_to\_merge\_at\_once
</div>

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

一次最多可合并的 parts 数量 (0 - 禁用) 。不会影响
OPTIMIZE FINAL 查询。
