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

# materialize_statistics_on_insert_* セッション設定

> materialize_statistics_on_insert_* 生成グループに属する ClickHouse セッション設定。

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](/ja/reference/system-tables/settings) で確認でき、[ソース](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) から自動生成されます。

<div id="materialize_statistics_on_insert">
  ## materialize\_statistics\_on\_insert
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.8"},{"label": "1"},{"label": "`materialize_statistics_on_insert_max_table_size` 未満のテーブルでは、デフォルトで INSERT 時にカラム統計をマテリアライズします。これにより、新たにロードされたディメンションテーブルに対するコストベースの join 順序変更で適切な推定値が得られます。"}]}, {"id": "row-2","items": [{"label": "26.4"},{"label": "0"},{"label": "デフォルトで INSERT 時に統計を構築しないようにし、代わりにマージに任せます"}]}, {"id": "row-3","items": [{"label": "24.6"},{"label": "1"},{"label": "INSERT 時の統計のマテリアライズを無効にできる新しい設定を追加しました"}]}]} />

新たに挿入されたパーツに対して統計が構築・マテリアライズされます。無効な場合でも、統計はマージ中または明示的な MATERIALIZE STATISTICS によって構築・保存されます。現在のテーブルサイズと書き込まれるブロックのサイズの合計が `materialize_statistics_on_insert_max_table_size` を超えないテーブルのみが対象です。

<div id="materialize_statistics_on_insert_max_table_size">
  ## materialize\_statistics\_on\_insert\_max\_table\_size
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.8"},{"label": "26843545600"},{"label": "新しい設定。"}]}]} />

現在のサイズに書き込み中のブロックを加えた値がこの値を超えないテーブルに対してのみ、新たに挿入されたパーツのカラム統計を構築・保存します (`materialize_statistics_on_insert` を参照)。`0` はサイズ上限なしを意味します。
