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

# use_partition_* 会话设置

> ClickHouse 中 use_partition_* 自动生成分组下的会话设置。

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="use_partition_minmax_for_primary_key_pruning">
  ## use\_partition\_minmax\_for\_primary\_key\_pruning
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "1"},{"label": "新增设置：当某个主键列同时也是分区键的输入列时，在 `MergeTree` 表的主键分析期间使用数据分区的 minmax 来剪枝更多粒度。"}]}]} />

当某个主键列同时也是分区键的输入列时，在 `MergeTree` 表的主键分析期间使用分区 minmax 索引边界来剪枝更多粒度。

例如，对于一个使用 `ORDER BY (id, event_time)` 和 `PARTITION BY toYYYYMM(event_time)` 的 `MergeTree` 表，ClickHouse 会在主键索引分析期间使用 `event_time` 上的分区 minmax 索引，从而做出更准确的粒度剪枝决策。

可能的值：

* 0 — 禁用。
* 1 — 启用。

<div id="use_partition_pruning">
  ## use\_partition\_pruning
</div>

**别名**：`use_partition_key`

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.3"},{"label": "1"},{"label": "控制 MergeTree 是否在查询执行期间使用分区键进行分区剪枝的新设置。`use_partition_key` 是此设置的别名。"}]}]} />

在查询执行期间，对 MergeTree 表使用分区键进行分区剪枝。

可能的值：

* 0 — 禁用。
* 1 — 启用。
