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

# replicated_deduplication_window_* MergeTree テーブル設定

> replicated_deduplication_window_* で生成されたグループ内の 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="replicated_deduplication_window">
  ## replicated\_deduplication\_window
</div>

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

ClickHouse Keeper が重複チェックのために
ハッシュサムを保存する、直近に挿入されたブロック数。

設定可能な値:

* 任意の正の整数。
* 0 (重複排除を無効化)

[挿入の重複排除](/ja/reference/engines/table-engines/mergetree-family/replication) では、
レプリケートテーブルへの書き込み時に、ClickHouse は重複排除用のハッシュサムを
ClickHouse Keeper に書き込みます。ハッシュサムが保存されるのは
直近の `replicated_deduplication_window` ブロックのみです。最も古いハッシュサムは
ClickHouse Keeper から削除されます。

ハッシュサムは挿入されたブロック全体を対象とするため、insert が重複排除されるのは、
個々の part 単位ではなく、データ全体が以前の insert (再試行) と一致する場合のみです。

`replicated_deduplication_window` に大きな値を指定すると、比較が必要な
エントリが増えるため、`Inserts` は遅くなります。

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

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

異なるバージョンが混在するローリングアップグレードのために維持されているレガシー設定です。新しい insert は
`replicated_deduplication_window` によって管理される統一ハッシュで重複排除されます。現在この
設定が制限するのは、ClickHouse Keeper の `async_blocks` ディレクトリに保持される
レガシー 非同期 INSERT ハッシュの数だけです。これらはローリングアップグレード中も古い
レプリカによって引き続き書き込まれ、リーダーによってクリーンアップされます。
値を `0` にすると 1 つも保持されず、次回のクリーンアップで全エントリが削除されます。そのため、
アップグレード中にレガシー async の重複排除ウィンドウを維持するには、デフォルト値 (またはそれ以上の値) のままにしてください。

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

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

挿入されたブロックのハッシュサムが
ClickHouse Keeper から削除されるまでの秒数です。

設定可能な値:

* 任意の正の整数。

[replicated\_deduplication\_window](/ja/reference/settings/merge-tree-settings/replicated-deduplication-window#replicated_deduplication_window)
と同様に、`replicated_deduplication_window_seconds` は挿入の重複排除のために
ブロックのハッシュサムをどのくらいの期間保存するかを指定します。`replicated_deduplication_window_seconds` より古い
ハッシュサムは、` replicated_deduplication_window` 未満であっても
ClickHouse Keeper から削除されます。

この時間は実時間ではなく、最新のレコードの時刻を基準とした相対時間です。
そのレコードしか存在しない場合は、永久に保存されます。

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

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

混在バージョンでのローリングアップグレード向けに維持されているレガシー設定です。
`replicated_deduplication_window_for_async_inserts` とあわせて、従来の非同期 INSERT ハッシュを
ClickHouse Keeper 内の `async_blocks` ディレクトリに保持する期間を制限します
(これらのハッシュは、ローリングアップグレード中に古いレプリカによって書き込まれ、
リーダーによってクリーンアップされます) 。新しい INSERT では
`replicated_deduplication_window_seconds` を使用します。
