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

# max_delay_* MergeTree テーブル設定

> max_delay_* グループに含まれる ClickHouse MergeTree テーブル設定。

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](/docs/ja/reference/system-tables/merge_tree_settings) で確認でき、ClickHouse のソースコードから自動生成されています。

<div id="max_delay_to_insert">
  ## max\_delay\_to\_insert
</div>

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

単一のパーティション内のアクティブなパーツ数が
[parts\_to\_delay\_insert](/docs/ja/reference/settings/merge-tree-settings/parts-to#parts_to_delay_insert) の値を超えた場合に、
`INSERT` の遅延の計算に使用される、秒単位の値です。

設定可能な値:

* 任意の正の整数。

`INSERT` の遅延 (Milliseconds) は、次の式で計算されます:

```code theme={null}
max_k = parts_to_throw_insert - parts_to_delay_insert
k = 1 + parts_count_in_partition - parts_to_delay_insert
delay_milliseconds = pow(max_delay_to_insert * 1000, k / max_k)
```

たとえば、あるパーティションにアクティブなパーツが 299 個あり、parts\_to\_throw\_insert
\= 300、parts\_to\_delay\_insert = 150、max\_delay\_to\_insert = 1 の場合、`INSERT` は
`pow( 1 * 1000, (1 + 299 - 150) / (300 - 150) ) = 1000`
ミリ秒だけ遅延されます。

バージョン 23.1 以降、式は次のように変更されました:

```code theme={null}
allowed_parts_over_threshold = parts_to_throw_insert - parts_to_delay_insert
parts_over_threshold = parts_count_in_partition - parts_to_delay_insert + 1
delay_milliseconds = max(min_delay_to_insert_ms, (max_delay_to_insert * 1000)
* parts_over_threshold / allowed_parts_over_threshold)
```

たとえば、あるパーティションにアクティブなパーツが 224 個あり、parts\_to\_throw\_insert
\= 300、parts\_to\_delay\_insert = 150、max\_delay\_to\_insert = 1、
min\_delay\_to\_insert\_ms = 10 の場合、`INSERT` は `max( 10, 1 * 1000 *
(224 - 150 + 1) / (300 - 150) ) = 500` ミリ秒だけ遅延されます。

<div id="max_delay_to_mutate_ms">
  ## max\_delay\_to\_mutate\_ms
</div>

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

未完了の mutation が多数ある場合の、MergeTree テーブル に対する mutation の最大遅延時間 (Milliseconds)
