]> begriffs open source - ai-pg/blob - full-docs/src/sgml/html/logical-replication.html
WIP: toc builder
[ai-pg] / full-docs / src / sgml / html / logical-replication.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!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>Chapter 29. Logical Replication</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="wal-internals.html" title="28.6. WAL Internals" /><link rel="next" href="logical-replication-publication.html" title="29.1. Publication" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">Chapter 29. Logical Replication</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="wal-internals.html" title="28.6. WAL Internals">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="admin.html" title="Part III. Server Administration">Up</a></td><th width="60%" align="center">Part III. Server Administration</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="logical-replication-publication.html" title="29.1. Publication">Next</a></td></tr></table><hr /></div><div class="chapter" id="LOGICAL-REPLICATION"><div class="titlepage"><div><div><h2 class="title">Chapter 29. Logical Replication</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="logical-replication-publication.html">29.1. Publication</a></span></dt><dd><dl><dt><span class="sect2"><a href="logical-replication-publication.html#LOGICAL-REPLICATION-PUBLICATION-REPLICA-IDENTITY">29.1.1. Replica Identity</a></span></dt></dl></dd><dt><span class="sect1"><a href="logical-replication-subscription.html">29.2. Subscription</a></span></dt><dd><dl><dt><span class="sect2"><a href="logical-replication-subscription.html#LOGICAL-REPLICATION-SUBSCRIPTION-SLOT">29.2.1. Replication Slot Management</a></span></dt><dt><span class="sect2"><a href="logical-replication-subscription.html#LOGICAL-REPLICATION-SUBSCRIPTION-EXAMPLES">29.2.2. Examples: Set Up Logical Replication</a></span></dt><dt><span class="sect2"><a href="logical-replication-subscription.html#LOGICAL-REPLICATION-SUBSCRIPTION-EXAMPLES-DEFERRED-SLOT">29.2.3. Examples: Deferred Replication Slot Creation</a></span></dt></dl></dd><dt><span class="sect1"><a href="logical-replication-failover.html">29.3. Logical Replication Failover</a></span></dt><dt><span class="sect1"><a href="logical-replication-row-filter.html">29.4. Row Filters</a></span></dt><dd><dl><dt><span class="sect2"><a href="logical-replication-row-filter.html#LOGICAL-REPLICATION-ROW-FILTER-RULES">29.4.1. Row Filter Rules</a></span></dt><dt><span class="sect2"><a href="logical-replication-row-filter.html#LOGICAL-REPLICATION-ROW-FILTER-RESTRICTIONS">29.4.2. Expression Restrictions</a></span></dt><dt><span class="sect2"><a href="logical-replication-row-filter.html#LOGICAL-REPLICATION-ROW-FILTER-TRANSFORMATIONS">29.4.3. UPDATE Transformations</a></span></dt><dt><span class="sect2"><a href="logical-replication-row-filter.html#LOGICAL-REPLICATION-ROW-FILTER-PARTITIONED-TABLE">29.4.4. Partitioned Tables</a></span></dt><dt><span class="sect2"><a href="logical-replication-row-filter.html#LOGICAL-REPLICATION-ROW-FILTER-INITIAL-DATA-SYNC">29.4.5. Initial Data Synchronization</a></span></dt><dt><span class="sect2"><a href="logical-replication-row-filter.html#LOGICAL-REPLICATION-ROW-FILTER-COMBINING">29.4.6. Combining Multiple Row Filters</a></span></dt><dt><span class="sect2"><a href="logical-replication-row-filter.html#LOGICAL-REPLICATION-ROW-FILTER-EXAMPLES">29.4.7. Examples</a></span></dt></dl></dd><dt><span class="sect1"><a href="logical-replication-col-lists.html">29.5. Column Lists</a></span></dt><dd><dl><dt><span class="sect2"><a href="logical-replication-col-lists.html#LOGICAL-REPLICATION-COL-LIST-EXAMPLES">29.5.1. Examples</a></span></dt></dl></dd><dt><span class="sect1"><a href="logical-replication-gencols.html">29.6. Generated Column Replication</a></span></dt><dt><span class="sect1"><a href="logical-replication-conflicts.html">29.7. Conflicts</a></span></dt><dt><span class="sect1"><a href="logical-replication-restrictions.html">29.8. Restrictions</a></span></dt><dt><span class="sect1"><a href="logical-replication-architecture.html">29.9. Architecture</a></span></dt><dd><dl><dt><span class="sect2"><a href="logical-replication-architecture.html#LOGICAL-REPLICATION-SNAPSHOT">29.9.1. Initial Snapshot</a></span></dt></dl></dd><dt><span class="sect1"><a href="logical-replication-monitoring.html">29.10. Monitoring</a></span></dt><dt><span class="sect1"><a href="logical-replication-security.html">29.11. Security</a></span></dt><dt><span class="sect1"><a href="logical-replication-config.html">29.12. Configuration Settings</a></span></dt><dd><dl><dt><span class="sect2"><a href="logical-replication-config.html#LOGICAL-REPLICATION-CONFIG-PUBLISHER">29.12.1. Publishers</a></span></dt><dt><span class="sect2"><a href="logical-replication-config.html#LOGICAL-REPLICATION-CONFIG-SUBSCRIBER">29.12.2. Subscribers</a></span></dt></dl></dd><dt><span class="sect1"><a href="logical-replication-upgrade.html">29.13. Upgrade</a></span></dt><dd><dl><dt><span class="sect2"><a href="logical-replication-upgrade.html#PREPARE-PUBLISHER-UPGRADES">29.13.1. Prepare for Publisher Upgrades</a></span></dt><dt><span class="sect2"><a href="logical-replication-upgrade.html#PREPARE-SUBSCRIBER-UPGRADES">29.13.2. Prepare for Subscriber Upgrades</a></span></dt><dt><span class="sect2"><a href="logical-replication-upgrade.html#UPGRADING-LOGICAL-REPLICATION-CLUSTERS">29.13.3. Upgrading Logical Replication Clusters</a></span></dt></dl></dd><dt><span class="sect1"><a href="logical-replication-quick-setup.html">29.14. Quick Setup</a></span></dt></dl></div><p>
3   Logical replication is a method of replicating data objects and their
4   changes, based upon their replication identity (usually a primary key).  We
5   use the term logical in contrast to physical replication, which uses exact
6   block addresses and byte-by-byte replication.  PostgreSQL supports both
7   mechanisms concurrently, see <a class="xref" href="high-availability.html" title="Chapter 26. High Availability, Load Balancing, and Replication">Chapter 26</a>.  Logical
8   replication allows fine-grained control over both data replication and
9   security.
10  </p><p>
11   Logical replication uses a <em class="firstterm">publish</em>
12   and <em class="firstterm">subscribe</em> model with one or
13   more <em class="firstterm">subscribers</em> subscribing to one or more
14   <em class="firstterm">publications</em> on a <em class="firstterm">publisher</em>
15   node.  Subscribers pull data from the publications they subscribe to and may
16   subsequently re-publish data to allow cascading replication or more complex
17   configurations.
18  </p><p>
19   When logical replication of a table typically starts, PostgreSQL takes
20   a snapshot of the table's data on the publisher database and copies it
21   to the subscriber.  Once complete, changes on the publisher since the
22   initial copy are sent continually to the subscriber.  The subscriber
23   applies the data in the same
24   order as the publisher so that transactional consistency is guaranteed for
25   publications within a single subscription.  This method of data replication
26   is sometimes referred to as transactional replication.
27  </p><p>
28   The typical use-cases for logical replication are:
29
30   </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
31      Sending incremental changes in a single database or a subset of a
32      database to subscribers as they occur.
33     </p></li><li class="listitem"><p>
34      Firing triggers for individual changes as they arrive on the
35      subscriber.
36     </p></li><li class="listitem"><p>
37      Consolidating multiple databases into a single one (for example for
38      analytical purposes).
39     </p></li><li class="listitem"><p>
40      Replicating between different major versions of PostgreSQL.
41     </p></li><li class="listitem"><p>
42      Replicating between PostgreSQL instances on different platforms (for
43      example Linux to Windows)
44     </p></li><li class="listitem"><p>
45      Giving access to replicated data to different groups of users.
46     </p></li><li class="listitem"><p>
47      Sharing a subset of the database between multiple databases.
48     </p></li></ul></div><p>
49  </p><p>
50   The subscriber database behaves in the same way as any other PostgreSQL
51   instance and can be used as a publisher for other databases by defining its
52   own publications.  When the subscriber is treated as read-only by
53   application, there will be no conflicts from a single subscription.  On the
54   other hand, if there are other writes done either by an application or by other
55   subscribers to the same set of tables, conflicts can arise.
56  </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="wal-internals.html" title="28.6. WAL Internals">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="admin.html" title="Part III. Server Administration">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="logical-replication-publication.html" title="29.1. Publication">Next</a></td></tr><tr><td width="40%" align="left" valign="top">28.6. WAL Internals </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 29.1. Publication</td></tr></table></div></body></html>