]> begriffs open source - ai-pg/blob - full-docs/txt/two-phase.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / two-phase.txt
1
2 67.4. Two-Phase Transactions #
3
4    PostgreSQL supports a two-phase commit (2PC) protocol that allows
5    multiple distributed systems to work together in a transactional
6    manner. The commands are PREPARE TRANSACTION, COMMIT PREPARED and
7    ROLLBACK PREPARED. Two-phase transactions are intended for use by
8    external transaction management systems. PostgreSQL follows the
9    features and model proposed by the X/Open XA standard, but does not
10    implement some less often used aspects.
11
12    When the user executes PREPARE TRANSACTION, the only possible next
13    commands are COMMIT PREPARED or ROLLBACK PREPARED. In general, this
14    prepared state is intended to be of very short duration, but external
15    availability issues might mean transactions stay in this state for an
16    extended interval. Short-lived prepared transactions are stored only in
17    shared memory and WAL. Transactions that span checkpoints are recorded
18    in the pg_twophase directory. Transactions that are currently prepared
19    can be inspected using pg_prepared_xacts.