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

# configurações de tabela do MergeTree map_buckets_*

> Configurações de tabela do MergeTree no ClickHouse no grupo gerado map_buckets_*.

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["Versão", "Valor padrão", "Comentário"];
  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
  }}>
        Histórico de versões
      </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
  }}>Tipo</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>Padrão</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          Pode ser alterado sem reiniciar
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

Essas configurações estão disponíveis em [system.merge\_tree\_settings](/pt-BR/reference/system-tables/merge_tree_settings) e são autogeradas a partir do código-fonte do ClickHouse.

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

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

O coeficiente usado nas estratégias `sqrt` e `linear` de [map\_buckets\_strategy](/pt-BR/reference/settings/merge-tree-settings/map-buckets#map_buckets_strategy) para calcular o número de buckets com base no tamanho médio do map.
Para a estratégia `sqrt`: `round(map_buckets_coefficient * sqrt(avg_map_size))`.
Para a estratégia `linear`: `round(map_buckets_coefficient * avg_map_size)`.
Ignorado quando `map_buckets_strategy` é `constant`.

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

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

O tamanho médio mínimo do map (número de chaves por linha) necessário para aplicar a serialização `with_buckets`.
Se o tamanho médio do map for menor que esse valor, será usado um único bucket, independentemente de outras configurações de bucket.
Um valor de `0` desabilita o limite e sempre aplica a estratégia de uso de buckets.
Essa configuração é útil para evitar a sobrecarga da serialização em buckets em maps pequenos, nos quais o benefício é insignificante.

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

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

Controla a estratégia de seleção do número de buckets na serialização `with_buckets` de `Map` com base no tamanho médio do map.

Valores possíveis:

* constant — Sempre usa [max\_buckets\_in\_map](/pt-BR/reference/settings/merge-tree-settings/max#max_buckets_in_map) como número de buckets, independentemente do tamanho médio do map.
* sqrt — Usa `round(map_buckets_coefficient * sqrt(avg_map_size))` como número de buckets, limitado ao intervalo `[1, max_buckets_in_map]`.
* linear — Usa `round(map_buckets_coefficient * avg_map_size)` como número de buckets, limitado ao intervalo `[1, max_buckets_in_map]`.
