> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-postgresql-tls-support.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# page_cache_* 会话设置

> ClickHouse 中 page_cache_* 生成组的会话设置。

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["版本", "默认值", "注释"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        版本历史
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

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](/zh/reference/system-tables/settings) 中查看，并由 [源文件](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<div id="page_cache_block_size">
  ## page\_cache\_block\_size
</div>

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

存储到用户态页缓存中的文件分块大小，以字节为单位。所有通过缓存进行的读取都会向上舍入到该大小的整数倍。

此设置可以在查询级别进行调整，但块大小不同的缓存项无法复用。更改此设置实际上会使缓存中现有的缓存项失效。

较大的值 (如 1 MiB) 适合高吞吐量查询，较小的值 (如 64 KiB) 适合低延迟的点查询。

<div id="page_cache_inject_eviction">
  ## page\_cache\_inject\_eviction
</div>

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

用户态页缓存有时会随机使某些页失效。用于测试。

<div id="page_cache_lookahead_blocks">
  ## page\_cache\_lookahead\_blocks
</div>

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

发生用户态页缓存未命中时，如果后续连续块也不在缓存中，则会一次性从底层存储中最多读取这么多个连续块。每个块的大小为 page\_cache\_block\_size 字节。

较高的值适合高吞吐量查询，而低延迟的点查询在不启用预读时效果更好。

<div id="page_cache_max_coalesced_bytes">
  ## page\_cache\_max\_coalesced\_bytes
</div>

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

当 `readBigAt` 填充用户态页缓存时，连续的缓存未命中会合并为一次从底层存储发起的读取。此设置以字节为单位限制单次合并读取的大小；如果连续未命中的范围更长，则会拆分为多次读取。它可限制并行冷读期间临时缓冲区的瞬时内存使用量。

较大的值可减少对象存储上冷 scan 的 HTTP request 数量；较小的值可降低瞬时内存峰值。
