> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-parallel-read-in-order-multi-part.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# primary_key_* MergeTree table settings

> ClickHouse MergeTree table settings in the primary_key_* generated group.

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
  }}>Type</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>Default</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          Changeable without restart
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

These settings are available in [system.merge\_tree\_settings](/reference/system-tables/merge_tree_settings) and are autogenerated from ClickHouse source.

<h2 id="primary_key_compress_block_size">
  primary\_key\_compress\_block\_size
</h2>

<SettingsInfoBlock type="NonZeroUInt64" default_value="65536" />

Size, in uncompressed bytes, of blocks used when writing a compressed primary-key index for new or rewritten data parts. Applies only when `compress_primary_key` is enabled. This controls compression framing and buffering; it does not change the primary key or index granularity.

<h2 id="primary_key_compression_codec">
  primary\_key\_compression\_codec
</h2>

<SettingsInfoBlock type="String" default_value="ZSTD(3)" />

Compression encoding used by primary, primary key is small enough and cached,
so the default compression is ZSTD(3).

<h2 id="primary_key_lazy_load">
  primary\_key\_lazy\_load
</h2>

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

Load primary key in memory on
first use instead of on table initialization. This can save memory in the
presence of a large number of tables.

<h2 id="primary_key_ratio_of_unique_prefix_values_to_skip_suffix_columns">
  primary\_key\_ratio\_of\_unique\_prefix\_values\_to\_skip\_suffix\_columns
</h2>

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

If the value of a column of the primary key in data part changes at least in
this ratio of times, skip loading next columns in memory. This allows to save
memory usage by not loading useless columns of the primary key.
