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

# filesystem_cache_* 会话设置

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

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>;
};

export const CloudOnlyBadge = () => {
  return <div className="cloudBadge">
            <div className="cloudIcon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path fillRule="evenodd" clipRule="evenodd" d="M5.33395 12.6667H12.3739C13.6593 12.6667 14.7073 11.6187 14.7073 10.3334C14.7073 9.04804 13.6593 8.00004 12.3739 8.00004H12.0839V7.33337C12.0839 5.12671 10.2906 3.33337 8.08395 3.33337C6.09928 3.33337 4.45395 4.78537 4.14195 6.68204C2.55728 6.76271 1.29395 8.06204 1.29395 9.66671C1.29395 11.3234 2.63728 12.6667 4.29395 12.6667H5.33395Z" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
            </svg>
        </div>
            {'仅限 ClickHouse Cloud'}
        </div>;
};

这些设置可在 [system.settings](/docs/zh/reference/system-tables/settings) 中找到，并由 [源代码](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<div id="filesystem_cache_allow_background_download">
  ## filesystem\_cache\_allow\_background\_download
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "1"},{"label": "用于控制文件系统缓存按查询在后台下载的新设置。"}]}]} />

允许文件系统缓存将从远程存储读取的数据加入后台下载队列。禁用后，当前查询/会话的下载将改为在前台进行。

<div id="filesystem_cache_boundary_alignment">
  ## filesystem\_cache\_boundary\_alignment
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "0"},{"label": "新增设置"}]}]} />

文件系统缓存边界对齐。此设置仅适用于非磁盘读取 (例如远程表引擎 / 表函数的缓存，不适用于 MergeTree 表的存储配置) 。值 0 表示不进行对齐。

<div id="filesystem_cache_enable_background_download_during_fetch">
  ## filesystem\_cache\_enable\_background\_download\_during\_fetch
</div>

<CloudOnlyBadge />

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "1"},{"label": "新增设置"}]}]} />

仅在 ClickHouse Cloud 中生效。锁定缓存的等待时间

<div id="filesystem_cache_enable_background_download_for_metadata_files_in_packed_storage">
  ## filesystem\_cache\_enable\_background\_download\_for\_metadata\_files\_in\_packed\_storage
</div>

<CloudOnlyBadge />

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "1"},{"label": "新设置"}]}]} />

仅在 ClickHouse Cloud 中有效。锁定缓存的等待时间

<div id="filesystem_cache_max_download_size">
  ## filesystem\_cache\_max\_download\_size
</div>

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

单个查询可下载的远程文件系统缓存的最大大小

<div id="filesystem_cache_name">
  ## filesystem\_cache\_name
</div>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.10"},{"label": ""},{"label": "用于无状态表引擎或数据湖的文件系统缓存名称"}]}]} />

用于无状态表引擎或数据湖的文件系统缓存名称

<div id="filesystem_cache_prefer_bigger_buffer_size">
  ## filesystem\_cache\_prefer\_bigger\_buffer\_size
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "1"},{"label": "新设置"}]}]} />

如果启用了文件系统缓存，则优先使用更大的缓冲区，以避免写入较小的 File 段，从而导致缓存性能下降。另一方面，启用此设置可能会增加内存占用。

<div id="filesystem_cache_reserve_space_wait_lock_timeout_milliseconds">
  ## filesystem\_cache\_reserve\_space\_wait\_lock\_timeout\_milliseconds
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.3"},{"label": "1000"},{"label": "为文件系统缓存预留空间时锁定缓存的等待时间"}]}]} />

为文件系统缓存预留空间时锁定缓存的等待时间

<div id="filesystem_cache_segments_batch_size">
  ## filesystem\_cache\_segments\_batch\_size
</div>

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

读取缓冲区一次可向缓存请求的单个 File 段批次大小上限。值过低会导致向缓存发起过多请求，值过高则可能减慢缓存逐出

<div id="filesystem_cache_skip_download_if_exceeds_per_query_cache_write_limit">
  ## filesystem\_cache\_skip\_download\_if\_exceeds\_per\_query\_cache\_write\_limit
</div>

**别名**: `skip_download_if_exceeds_query_cache`

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "1"},{"label": "设置 skip_download_if_exceeds_query_cache_limit 的重命名"}]}]} />

如果会超过查询缓存大小，则跳过从远程文件系统下载
