> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MySQL ClickPipe の同期を制御する

> MySQL ClickPipe の同期制御に関するドキュメント

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

このドキュメントでは、ClickPipe が **CDC (変更データキャプチャ) (Running) モード** の場合に、MySQL ClickPipe の同期を制御する方法を説明します。

<div id="overview">
  ## 概要
</div>

Database ClickPipes は、ソースデータベースからデータを取得する処理と、移行先データベースへデータを送信する処理という、並行して動作する 2 つのプロセスから成るアーキテクチャです。取得側のプロセスは同期設定によって制御され、データをどのくらいの頻度で取得するか、また 1 回にどの程度のデータを取得するかを定義します。ここでいう「1 回」とは 1 バッチのことで、ClickPipe はデータをバッチ単位で取得および送信します。

MySQL ClickPipe の同期を制御する主な方法は 2 つあります。以下の設定のいずれかの条件を満たすと、ClickPipe はデータの送信を開始します。

<div id="interval">
  ### 同期間隔
</div>

パイプの同期間隔は、ClickPipe がソースデータベースからレコードを取得する時間の長さ (秒単位) です。取得したデータを ClickHouse に送信する時間は、この間隔には含まれません。

既定値は**1 分**です。
同期間隔には任意の正の整数値を設定できますが、10 秒を超える値にすることを推奨します。

<div id="batch-size">
  ### Pull バッチサイズ
</div>

Pull バッチサイズは、ClickPipe がソースデータベースから 1 回のバッチで取得するレコード数です。ここでいうレコードとは、そのパイプに含まれるテーブルに対する insert、更新、削除を指します。

デフォルトは **100,000** レコードです。
安全な最大値は 1,000 万レコードです。

<div id="transactions">
  ### 例外: ソース上の長時間実行トランザクション
</div>

ソースデータベース上でトランザクションが実行されると、ClickPipe はそのトランザクションの COMMIT を受信するまで待機してから処理を進めます。これにより、同期間隔と Pull バッチサイズの両方よりもこちらが優先されます。

<div id="configuring">
  ### 同期設定の構成
</div>

ClickPipe の作成時または既存の ClickPipe の編集時に、同期間隔と Pull バッチサイズを設定できます。
ClickPipe の作成時には、以下のように作成ウィザードの 2 番目のステップで設定できます。

<Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/8xU-7NRzcVe16bmG/images/integrations/data-ingestion/clickpipes/postgres/create_sync_settings.png?fit=max&auto=format&n=8xU-7NRzcVe16bmG&q=85&s=412a27effa804c759b0b303c959754ac" alt="同期設定を作成" size="md" width="902" height="654" data-path="images/integrations/data-ingestion/clickpipes/postgres/create_sync_settings.png" />

既存の ClickPipe を編集する場合は、パイプの **Settings** タブに移動し、パイプを一時停止してから、ここで **Configure** をクリックします。

<Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/8xU-7NRzcVe16bmG/images/integrations/data-ingestion/clickpipes/postgres/edit_sync_button.png?fit=max&auto=format&n=8xU-7NRzcVe16bmG&q=85&s=30b39dfdad9cce8936706e7c8282ab0e" alt="同期編集ボタン" size="md" width="933" height="417" data-path="images/integrations/data-ingestion/clickpipes/postgres/edit_sync_button.png" />

すると、同期設定を表示するフライアウトが開き、そこで同期間隔と Pull バッチサイズを変更できます。

<Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/8xU-7NRzcVe16bmG/images/integrations/data-ingestion/clickpipes/postgres/sync_settings_edit.png?fit=max&auto=format&n=8xU-7NRzcVe16bmG&q=85&s=a2a2c74960206a297f679bda02614969" alt="同期設定を編集" size="md" width="598" height="588" data-path="images/integrations/data-ingestion/clickpipes/postgres/sync_settings_edit.png" />

<div id="monitoring">
  ### 同期制御の挙動を監視する
</div>

各バッチにかかる時間は、ClickPipe の **Metrics** タブにある **CDC Syncs** テーブルで確認できます。ここでの所要時間には、プッシュにかかる時間に加え、受信する行がない場合に ClickPipe が待機する時間も含まれます。

<Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/8xU-7NRzcVe16bmG/images/integrations/data-ingestion/clickpipes/postgres/cdc_syncs.png?fit=max&auto=format&n=8xU-7NRzcVe16bmG&q=85&s=9516e13f2173892288776aa86a587959" alt="CDC Syncs テーブル" size="md" width="2428" height="626" data-path="images/integrations/data-ingestion/clickpipes/postgres/cdc_syncs.png" />
