バージョンごとのドキュメント一覧

74.4. 2相トランザクション #

<title>Two-Phase Transactions</title>

<productname>PostgreSQL</productname> supports a two-phase commit (2PC) protocol that allows multiple distributed systems to work together in a transactional manner. The commands are <command>PREPARE TRANSACTION</command>, <command>COMMIT PREPARED</command> and <command>ROLLBACK PREPARED</command>. Two-phase transactions are intended for use by external transaction management systems. <productname>PostgreSQL</productname> follows the features and model proposed by the X/Open XA standard, but does not implement some less often used aspects. PostgreSQLは、複数の分散システムがトランザクション処理として連携することを可能にする2相コミット(2PC)プロトコルをサポートしています。 そのコマンドはPREPARE TRANSACTIONCOMMIT PREPAREDROLLBACK PREPAREDです。 2相トランザクションは外部のトランザクション制御システムで使用することを意図しています。 PostgreSQLは、X/Open XA標準で提案されている機能とモデルに従いますが、あまり使用されていないいくつかの側面は実装しません。

When the user executes <command>PREPARE TRANSACTION</command>, the only possible next commands are <command>COMMIT PREPARED</command> or <command>ROLLBACK PREPARED</command>. In general, this prepared state is intended to be of very short duration, but external availability issues might mean transactions stay in this state for an extended interval. Short-lived prepared transactions are stored only in shared memory and WAL. Transactions that span checkpoints are recorded in the <filename>pg_twophase</filename> directory. Transactions that are currently prepared can be inspected using <link linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>. ユーザがPREPARE TRANSACTIONを実行すると、次のコマンドとしてはCOMMIT PREPAREDまたはROLLBACK PREPAREDしか使用できません。 一般的に、この準備済み状態は非常に短い期間であることを意図していますが、外部での可用性の問題により、トランザクションがこの状態に長期間とどまる可能性があります。 短命な準備済みトランザクションは共有メモリとWALにのみ格納されます。 チェックポイントをまたいだトランザクションはpg_twophaseディレクトリに記録されます。 現在準備済みのトランザクションはpg_prepared_xactsを使用して検査できます。