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

# map_buckets_* MergeTree テーブル設定

> map_buckets_* グループに生成される 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](/ja/reference/system-tables/merge_tree_settings) で参照でき、ClickHouse のソースコードから自動生成されています。

<div id="map_buckets_coefficient">
  ## map\_buckets\_coefficient
</div>

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

平均マップサイズからバケット数を計算する際に、`sqrt` および `linear` [map\_buckets\_strategy](/ja/reference/settings/merge-tree-settings/map-buckets#map_buckets_strategy) で使用される係数です。
`sqrt` 戦略の場合: `round(map_buckets_coefficient * sqrt(avg_map_size))`。
`linear` 戦略の場合: `round(map_buckets_coefficient * avg_map_size)`。
`map_buckets_strategy` が `constant` の場合、この設定は無視されます。

<div id="map_buckets_min_avg_size">
  ## map\_buckets\_min\_avg\_size
</div>

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

`with_buckets` シリアライゼーションを適用するために必要な、最小の平均マップサイズ (1行あたりのキー数) です。
平均マップサイズがこの値より小さい場合は、他のバケット設定に関係なく単一のバケットが使用されます。
値が `0` の場合、このしきい値は無効になり、常にバケット化戦略が適用されます。
この設定は、小さなマップでは効果がほとんどない場合に、バケット化シリアライゼーションのオーバーヘッドを避けるのに役立ちます。

<div id="map_buckets_strategy">
  ## map\_buckets\_strategy
</div>

<SettingsInfoBlock type="MergeTreeMapBucketsStrategy" default_value="sqrt" />

平均マップサイズに基づいて、`with_buckets` `Map` シリアライゼーションにおけるバケット数の選択戦略を制御します。

設定可能な値:

* constant — 平均マップサイズに関係なく、常に [max\_buckets\_in\_map](/ja/reference/settings/merge-tree-settings/max#max_buckets_in_map) をバケット数として使用します。
* sqrt — バケット数として `round(map_buckets_coefficient * sqrt(avg_map_size))` を使用し、`[1, max_buckets_in_map]` の範囲に制限します。
* linear — バケット数として `round(map_buckets_coefficient * avg_map_size)` を使用し、`[1, max_buckets_in_map]` の範囲に制限します。
