Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

map_buckets_* MergeTree table settings

These settings are available in system.merge_tree_settings and are autogenerated from ClickHouse source.

map_buckets_coefficient

Type
Float
Default
1
Version history
VersionDefault valueComment
26.31Add a setting to control the coefficient used in `sqrt` and `linear` strategy for calculating the number of buckets for 'with_buckets' Map serialization

The coefficient used in sqrt and linear map_buckets_strategy to calculate the number of buckets from the average map size. For sqrt strategy: round(map_buckets_coefficient * sqrt(avg_map_size)). For linear strategy: round(map_buckets_coefficient * avg_map_size). Ignored when map_buckets_strategy is constant.

map_buckets_min_avg_size

Type
UInt64
Default
32
Version history
VersionDefault valueComment
26.332Add a setting to control the minimum average map size (number of keys per row) required to apply `with_buckets` serialization

The minimum average map size (number of keys per row) required to apply with_buckets serialization. If the average map size is less than this value, a single bucket is used regardless of other bucket settings. A value of 0 disables the threshold and always applies the bucketing strategy. This setting is useful to avoid the overhead of bucketed serialization for small maps where the benefit is negligible.

map_buckets_strategy

Type
MergeTreeMapBucketsStrategy
Default
sqrt
Version history
VersionDefault valueComment
26.3sqrtAdd a setting to control the strategy for choosing the number of buckets for 'with_buckets' Map serialization

Controls the strategy for choosing the number of buckets in with_buckets Map serialization based on the average map size.

Possible values:

  • constant — Always use max_buckets_in_map as the number of buckets, regardless of the average map size.
  • sqrt — Use round(map_buckets_coefficient * sqrt(avg_map_size)) as the number of buckets, clamped to [1, max_buckets_in_map].
  • linear — Use round(map_buckets_coefficient * avg_map_size) as the number of buckets, clamped to [1, max_buckets_in_map].
Navigation