> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# replicated_deduplication_window_* MergeTree table settings

> ClickHouse MergeTree table settings in the replicated_deduplication_window_* 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](/docs/reference/system-tables/merge_tree_settings) and are autogenerated from ClickHouse source.

<h2 id="replicated_deduplication_window">
  replicated\_deduplication\_window
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.9"},{"label": "10000"},{"label": "increase default value"}]}]} />

The number of most recently inserted blocks for which ClickHouse Keeper stores
hash sums to check for duplicates.

Possible values:

* Any positive integer.
* 0 (disable deduplication)

For [insert deduplication](/docs/reference/engines/table-engines/mergetree-family/replication),
when writing into replicated tables, ClickHouse writes deduplication hash sums into
ClickHouse Keeper. Hash sums are stored only for the most recent
`replicated_deduplication_window` blocks. The oldest hash sums are removed from
ClickHouse Keeper.

The hash sum covers the whole inserted block, so an insert is deduplicated only when its
entire data matches a previous insert (a retry), not per individual part.

A large number for `replicated_deduplication_window` slows down `Inserts` because more
entries need to be compared.

<h2 id="replicated_deduplication_window_for_async_inserts">
  replicated\_deduplication\_window\_for\_async\_inserts
</h2>

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

Legacy setting retained for mixed-version rolling upgrades. New inserts deduplicate with the
unified hash governed by `replicated_deduplication_window`; this setting now only bounds how many
legacy async-insert hashes are kept in the `async_blocks` directory in ClickHouse Keeper, which is
still written by older replicas during a rolling upgrade and cleaned up by the current leader.
A value of `0` retains none of them — the next cleanup pass removes every entry — so keep the
default (or a larger value) to preserve the legacy async deduplication window during the upgrade.

<h2 id="replicated_deduplication_window_seconds">
  replicated\_deduplication\_window\_seconds
</h2>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.10"},{"label": "3600"},{"label": "decrease default value"}]}]} />

The number of seconds after which the hash sums of the inserted blocks are
removed from ClickHouse Keeper.

Possible values:

* Any positive integer.

Similar to [replicated\_deduplication\_window](/docs/reference/settings/merge-tree-settings/replicated-deduplication-window#replicated_deduplication_window),
`replicated_deduplication_window_seconds` specifies how long to store hash
sums of blocks for insert deduplication. Hash sums older than
`replicated_deduplication_window_seconds` are removed from ClickHouse Keeper,
even if they are less than ` replicated_deduplication_window`.

The time is relative to the time of the most recent record, not to the wall
time. If it's the only record it will be stored forever.

<h2 id="replicated_deduplication_window_seconds_for_async_inserts">
  replicated\_deduplication\_window\_seconds\_for\_async\_inserts
</h2>

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

Legacy setting retained for mixed-version rolling upgrades. Together with
`replicated_deduplication_window_for_async_inserts` it bounds how long legacy async-insert hashes
are kept in the `async_blocks` directory in ClickHouse Keeper (written by older replicas during a
rolling upgrade and cleaned up by the current leader). New inserts use
`replicated_deduplication_window_seconds`.
