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

# distributed_background_* セッション設定

> 自動生成された distributed_background_* グループ内の ClickHouse セッション設定。

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.settings](/docs/ja/reference/system-tables/settings)で参照でき、[ソースコード](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp)から自動生成されています。

<div id="distributed_background_insert_batch">
  ## distributed\_background\_insert\_batch
</div>

**別名**: `distributed_directory_monitor_batch_inserts`

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

挿入されたデータをバッチで送信するかどうかを切り替えます。

バッチ送信を有効にすると、[Distributed](/docs/ja/reference/engines/table-engines/special/distributed) テーブルエンジンは、挿入されたデータの複数のファイルを個別に送信する代わりに、1 回の操作でまとめて送信しようとします。バッチ送信により、サーバーやネットワークのリソースをより効率的に活用できるため、クラスターのパフォーマンスが向上します。

設定可能な値:

* 1 — 有効。
* 0 — 無効。

<div id="distributed_background_insert_max_sleep_time_ms">
  ## distributed\_background\_insert\_max\_sleep\_time\_ms
</div>

**別名**: `distributed_directory_monitor_max_sleep_time_ms`

<SettingsInfoBlock type="Milliseconds" default_value="30000" />

[Distributed](/docs/ja/reference/engines/table-engines/special/distributed) テーブルエンジンがデータを送信する際の最大間隔です。[distributed\_background\_insert\_sleep\_time\_ms](/docs/ja/reference/settings/session-settings/distributed-background#distributed_background_insert_sleep_time_ms) 設定で指定される間隔の指数関数的な増加を制限します。

設定可能な値:

* ミリ秒単位の正の整数

<div id="distributed_background_insert_sleep_time_ms">
  ## distributed\_background\_insert\_sleep\_time\_ms
</div>

**別名**: `distributed_directory_monitor_sleep_time_ms`

<SettingsInfoBlock type="Milliseconds" default_value="100" />

[Distributed](/docs/ja/reference/engines/table-engines/special/distributed)テーブルエンジンがデータを送信する際の基本的な待機間隔です。実際の間隔は、エラーが発生すると指数関数的に増加します。

設定可能な値:

* 正の整数のミリ秒数。

<div id="distributed_background_insert_split_batch_on_failure">
  ## distributed\_background\_insert\_split\_batch\_on\_failure
</div>

**別名**: `distributed_directory_monitor_split_batch_on_failure`

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

障害発生時にバッチを分割する機能を有効または無効にします。

特定のバッチをリモート分片に送信する際、その後段に複雑なパイプライン (たとえば `GROUP BY` を含む `MATERIALIZED VIEW`) があると、`Memory limit exceeded` などのエラーで失敗することがあります。この場合、再試行しても解決せず (その結果、そのテーブルの分散送信が滞ることがあります) 、そのバッチ内のファイルを 1 つずつ送信すれば INSERT に成功する可能性があります。

そのため、この設定を `1` にすると、そのようなバッチではバッチ処理が無効になります (つまり、失敗したバッチに対して `distributed_background_insert_batch` が一時的に無効になります) 。

設定可能な値:

* 1 — 有効。
* 0 — 無効。

<Note>
  この設定は、破損したバッチにも影響します (これはサーバー (マシン) の異常終了や、[Distributed](/docs/ja/reference/engines/table-engines/special/distributed) テーブルエンジンで `fsync_after_insert`/`fsync_directories` がない場合に発生することがあります) 。
</Note>

<Note>
  自動バッチ分割には依存しないでください。パフォーマンスに悪影響を及ぼす可能性があります。
</Note>

<div id="distributed_background_insert_timeout">
  ## distributed\_background\_insert\_timeout
</div>

**別名**: `insert_distributed_timeout`

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

`distributed` への INSERT クエリのタイムアウトです。この設定は、`insert_distributed_sync` が有効な場合にのみ適用されます。値が 0 の場合は、タイムアウトしないことを意味します。
