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

# write_* MergeTree 表设置

> 归入 write_* 生成分组的 ClickHouse 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="write_final_mark">
  ## write\_final\_mark
</div>

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

已废弃设置，不起任何作用。

<div id="write_marks_for_substreams_in_compact_parts">
  ## write\_marks\_for\_substreams\_in\_compact\_parts
</div>

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

启用后，在 Compact parts 中将按每个子流而不是按每一列写入标记。
这样便可以高效地从数据分区片段中读取单独的子列。

例如，列 `t Tuple(a String, b UInt32, c Array(Nullable(UInt32)))` 会被序列化为以下子流：

* `t.a` 表示 tuple 元素 `a` 的 String 数据
* `t.b` 表示 tuple 元素 `b` 的 UInt32 数据
* `t.c.size0` 表示 tuple 元素 `c` 的数组大小
* `t.c.null` 表示 tuple 元素 `c` 中嵌套数组元素的 null map
* `t.c` 表示 tuple 元素 `c` 中嵌套数组元素的 UInt32 数据

启用此设置后，我们会为这 5 个子流分别写入一个标记，这意味着在需要时，可以分别从粒度中读取每个子流的
数据。例如，如果我们想读取子列 `t.c`，则只会读取
子流 `t.c.size0`、`t.c.null` 和 `t.c` 的数据，而不会读取子流 `t.a` 和 `t.b` 的数据。禁用此设置时，
我们只会为顶层列 `t` 写入一个标记，这意味着即使我们只需要某些子流的数据，也始终会从粒度中读取整列数据。
