blob: 2b6d4e7f5e9ae3b2b0581115a81e8a382ae45f70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>74.4. Two-Phase Transactions</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="subxacts.html" title="74.3. Subtransactions" /><link rel="next" href="bki.html" title="Chapter 75. System Catalog Declarations and Initial Contents" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">74.4. Two-Phase Transactions</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="subxacts.html" title="74.3. Subtransactions">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="transactions.html" title="Chapter 74. Transaction Processing">Up</a></td><th width="60%" align="center">Chapter 74. Transaction Processing</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="bki.html" title="Chapter 75. System Catalog Declarations and Initial Contents">Next</a></td></tr></table><hr /></div><div class="sect1" id="TWO-PHASE"><div class="titlepage"><div><div><h2 class="title" style="clear: both">74.4. Two-Phase Transactions <a href="#TWO-PHASE" class="id_link">#</a></h2></div></div></div><p>
<span class="productname">PostgreSQL</span> supports a two-phase commit (2PC)
protocol that allows multiple distributed systems to work together
in a transactional manner. The commands are <code class="command">PREPARE
TRANSACTION</code>, <code class="command">COMMIT PREPARED</code> and
<code class="command">ROLLBACK PREPARED</code>. Two-phase transactions
are intended for use by external transaction management systems.
<span class="productname">PostgreSQL</span> follows the features and model
proposed by the X/Open XA standard, but does not implement some less
often used aspects.
</p><p>
When the user executes <code class="command">PREPARE TRANSACTION</code>, the
only possible next commands are <code class="command">COMMIT PREPARED</code>
or <code class="command">ROLLBACK PREPARED</code>. 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
<code class="filename">pg_twophase</code> directory. Transactions
that are currently prepared can be inspected using <a class="link" href="view-pg-prepared-xacts.html" title="54.16. pg_prepared_xacts"><code class="structname">pg_prepared_xacts</code></a>.
</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="subxacts.html" title="74.3. Subtransactions">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="transactions.html" title="Chapter 74. Transaction Processing">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bki.html" title="Chapter 75. System Catalog Declarations and Initial Contents">Next</a></td></tr><tr><td width="40%" align="left" valign="top">74.3. Subtransactions </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> Chapter 75. System Catalog Declarations and Initial Contents</td></tr></table></div></body></html>
|