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

# use_* MergeTree 表设置

> ClickHouse 在 use_* 自动生成组中的 MergeTree 表设置。

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

<div id="use_adaptive_write_buffer_for_dynamic_subcolumns">
  ## use\_adaptive\_write\_buffer\_for\_dynamic\_subcolumns
</div>

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

允许在写入 Dynamic 子列时使用自适应写入缓冲区，以
降低内存占用

<div id="use_async_block_ids_cache">
  ## use\_async\_block\_ids\_cache
</div>

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

已废弃，不起任何作用。

<div id="use_compact_variant_discriminators_serialization">
  ## use\_compact\_variant\_discriminators\_serialization
</div>

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

为 Variant
数据类型中判别值的二进制序列化启用紧凑模式。
当大多数情况下只有一种 Variant，或存在大量 NULL 值时，
此模式可显著减少在 parts 中存储判别值所需的内存。

<div id="use_const_adaptive_granularity">
  ## use\_const\_adaptive\_granularity
</div>

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

始终对整个数据分片使用固定粒度。这样可以压缩内存中保存的索引粒度值。在工作负载极大且表很窄的情况下，这项设置会很有用。

<div id="use_metadata_cache">
  ## use\_metadata\_cache
</div>

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

已废弃，不起任何作用。

<div id="use_primary_key_cache">
  ## use\_primary\_key\_cache
</div>

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

使用缓存来存储主索引，
而不是将所有索引都保存在内存中。对于非常大的表，这可能很有用
