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

# preferred_* 会话设置

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

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) 中查看，由 [source](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<div id="preferred_block_size_bytes">
  ## preferred\_block\_size\_bytes
</div>

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

此设置用于调整查询处理中的数据块大小，是对较粗略的 `max_block_size` 设置的进一步微调。如果列较大，并且按 `max_block_size` 指定的行数计算后，块大小很可能超过指定的字节数，则会下调其大小，以获得更好的 CPU 缓存局部性。

<div id="preferred_max_column_in_block_size_bytes">
  ## preferred\_max\_column\_in\_block\_size\_bytes
</div>

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

读取时对块中单列最大大小的限制。有助于减少缓存未命中的次数。应接近 L2 缓存大小。

<div id="preferred_optimize_projection_name">
  ## preferred\_optimize\_projection\_name
</div>

如果将其设置为非空字符串，ClickHouse 将尝试在查询中应用指定的投影。

可能的值：

* string：首选投影的名称
