]> begriffs open source - ai-pg/blob - full-docs/html/view-pg-replication-slots.html
Include latest toc output
[ai-pg] / full-docs / html / view-pg-replication-slots.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>53.20. pg_replication_slots</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="view-pg-replication-origin-status.html" title="53.19. pg_replication_origin_status" /><link rel="next" href="view-pg-roles.html" title="53.21. pg_roles" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">53.20. <code class="structname">pg_replication_slots</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="view-pg-replication-origin-status.html" title="53.19. pg_replication_origin_status">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="views.html" title="Chapter 53. System Views">Up</a></td><th width="60%" align="center">Chapter 53. System Views</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="view-pg-roles.html" title="53.21. pg_roles">Next</a></td></tr></table><hr /></div><div class="sect1" id="VIEW-PG-REPLICATION-SLOTS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">53.20. <code class="structname">pg_replication_slots</code> <a href="#VIEW-PG-REPLICATION-SLOTS" class="id_link">#</a></h2></div></div></div><a id="id-1.10.5.24.2" class="indexterm"></a><p>
3    The <code class="structname">pg_replication_slots</code> view provides a listing
4    of all replication slots that currently exist on the database cluster,
5    along with their current state.
6   </p><p>
7    For more on replication slots,
8    see <a class="xref" href="warm-standby.html#STREAMING-REPLICATION-SLOTS" title="26.2.6. Replication Slots">Section 26.2.6</a> and <a class="xref" href="logicaldecoding.html" title="Chapter 47. Logical Decoding">Chapter 47</a>.
9   </p><div class="table" id="id-1.10.5.24.5"><p class="title"><strong>Table 53.20. <code class="structname">pg_replication_slots</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_replication_slots Columns" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
10        Column Type
11       </p>
12       <p>
13        Description
14       </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
15        <code class="structfield">slot_name</code> <code class="type">name</code>
16       </p>
17       <p>
18        A unique, cluster-wide identifier for the replication slot
19       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
20        <code class="structfield">plugin</code> <code class="type">name</code>
21       </p>
22       <p>
23        The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.
24       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
25        <code class="structfield">slot_type</code> <code class="type">text</code>
26       </p>
27       <p>
28        The slot type: <code class="literal">physical</code> or <code class="literal">logical</code>
29       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
30        <code class="structfield">datoid</code> <code class="type">oid</code>
31        (references <a class="link" href="catalog-pg-database.html" title="52.15. pg_database"><code class="structname">pg_database</code></a>.<code class="structfield">oid</code>)
32       </p>
33       <p>
34        The OID of the database this slot is associated with, or
35        null. Only logical slots have an associated database.
36       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
37        <code class="structfield">database</code> <code class="type">name</code>
38        (references <a class="link" href="catalog-pg-database.html" title="52.15. pg_database"><code class="structname">pg_database</code></a>.<code class="structfield">datname</code>)
39       </p>
40       <p>
41        The name of the database this slot is associated with, or
42        null. Only logical slots have an associated database.
43       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
44        <code class="structfield">temporary</code> <code class="type">bool</code>
45       </p>
46       <p>
47        True if this is a temporary replication slot. Temporary slots are
48        not saved to disk and are automatically dropped on error or when
49        the session has finished.
50       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
51        <code class="structfield">active</code> <code class="type">bool</code>
52       </p>
53       <p>
54        True if this slot is currently being streamed
55       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
56        <code class="structfield">active_pid</code> <code class="type">int4</code>
57       </p>
58       <p>
59        The process ID of the session streaming data for this slot.
60        <code class="literal">NULL</code> if inactive.
61       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
62        <code class="structfield">xmin</code> <code class="type">xid</code>
63       </p>
64       <p>
65        The oldest transaction that this slot needs the database to
66        retain.  <code class="literal">VACUUM</code> cannot remove tuples deleted
67        by any later transaction.
68       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
69        <code class="structfield">catalog_xmin</code> <code class="type">xid</code>
70       </p>
71       <p>
72        The oldest transaction affecting the system catalogs that this
73        slot needs the database to retain.  <code class="literal">VACUUM</code> cannot
74        remove catalog tuples deleted by any later transaction.
75       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
76        <code class="structfield">restart_lsn</code> <code class="type">pg_lsn</code>
77       </p>
78       <p>
79        The address (<code class="literal">LSN</code>) of oldest WAL which still
80        might be required by the consumer of this slot and thus won't be
81        automatically removed during checkpoints unless this LSN
82        gets behind more than <a class="xref" href="runtime-config-replication.html#GUC-MAX-SLOT-WAL-KEEP-SIZE">max_slot_wal_keep_size</a>
83        from the current LSN.  <code class="literal">NULL</code>
84        if the <code class="literal">LSN</code> of this slot has never been reserved.
85       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
86        <code class="structfield">confirmed_flush_lsn</code> <code class="type">pg_lsn</code>
87       </p>
88       <p>
89        The address (<code class="literal">LSN</code>) up to which the logical
90        slot's consumer has confirmed receiving data. Data corresponding to the
91        transactions committed before this <code class="literal">LSN</code> is not
92        available anymore. <code class="literal">NULL</code> for physical slots.
93       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
94        <code class="structfield">wal_status</code> <code class="type">text</code>
95       </p>
96       <p>
97        Availability of WAL files claimed by this slot.
98        Possible values are:
99        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">reserved</code> means that the claimed files
100           are within <code class="varname">max_wal_size</code>.</p></li><li class="listitem"><p><code class="literal">extended</code> means
101           that <code class="varname">max_wal_size</code> is exceeded but the files are
102           still retained, either by the replication slot or
103           by <code class="varname">wal_keep_size</code>.
104          </p></li><li class="listitem"><p>
105           <code class="literal">unreserved</code> means that the slot no longer
106           retains the required WAL files and some of them are to be removed at
107           the next checkpoint.  This typically occurs when
108           <a class="xref" href="runtime-config-replication.html#GUC-MAX-SLOT-WAL-KEEP-SIZE">max_slot_wal_keep_size</a> is set to
109           a non-negative value.  This state can return
110           to <code class="literal">reserved</code> or <code class="literal">extended</code>.
111          </p></li><li class="listitem"><p>
112           <code class="literal">lost</code> means that this slot is no longer usable.
113          </p></li></ul></div><p>
114       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
115        <code class="structfield">safe_wal_size</code> <code class="type">int8</code>
116       </p>
117       <p>
118        The number of bytes that can be written to WAL such that this slot
119        is not in danger of getting in state "lost".  It is NULL for lost
120        slots, as well as if <code class="varname">max_slot_wal_keep_size</code>
121        is <code class="literal">-1</code>.
122       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
123        <code class="structfield">two_phase</code> <code class="type">bool</code>
124       </p>
125       <p>
126        True if the slot is enabled for decoding prepared transactions.  Always
127        false for physical slots.
128       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
129        <code class="structfield">two_phase_at</code> <code class="type">pg_lsn</code>
130       </p>
131       <p>
132        The address (<code class="literal">LSN</code>) from which the decoding of prepared
133        transactions is enabled. <code class="literal">NULL</code> for logical slots
134        where <code class="structfield">two_phase</code> is false and for physical slots.
135       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
136        <code class="structfield">inactive_since</code> <code class="type">timestamptz</code>
137       </p>
138       <p>
139         The time when the slot became inactive. <code class="literal">NULL</code> if the
140         slot is currently being streamed. If the slot becomes invalid,
141         this value will never be updated.
142         For standby slots that are being synced from a
143         primary server (whose <code class="structfield">synced</code> field is
144         <code class="literal">true</code>), the <code class="structfield">inactive_since</code>
145         indicates the time when slot synchronization (see <a class="xref" href="logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION" title="47.2.3. Replication Slot Synchronization">Section 47.2.3</a>)
146         was most recently stopped.  <code class="literal">NULL</code> if the slot
147         has always been synchronized. This helps standby slots track when
148         synchronization was interrupted.
149       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
150        <code class="structfield">conflicting</code> <code class="type">bool</code>
151       </p>
152       <p>
153        True if this logical slot conflicted with recovery (and so is now
154        invalidated). When this column is true, check
155        <code class="structfield">invalidation_reason</code> column for the conflict
156        reason. Always <code class="literal">NULL</code> for physical slots.
157       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
158        <code class="structfield">invalidation_reason</code> <code class="type">text</code>
159       </p>
160       <p>
161        The reason for the slot's invalidation. It is set for both logical and
162        physical slots. <code class="literal">NULL</code> if the slot is not invalidated.
163        Possible values are:
164        </p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
165           <code class="literal">wal_removed</code> means that the required WAL has been
166           removed.
167          </p></li><li class="listitem"><p>
168           <code class="literal">rows_removed</code> means that the required rows have
169           been removed. It is set only for logical slots.
170          </p></li><li class="listitem"><p>
171           <code class="literal">wal_level_insufficient</code> means that the
172           primary doesn't have a <a class="xref" href="runtime-config-wal.html#GUC-WAL-LEVEL">wal_level</a> sufficient to
173           perform logical decoding.  It is set only for logical slots.
174          </p></li><li class="listitem"><p>
175           <code class="literal">idle_timeout</code> means that the slot has remained
176           inactive longer than the configured
177           <a class="xref" href="runtime-config-replication.html#GUC-IDLE-REPLICATION-SLOT-TIMEOUT">idle_replication_slot_timeout</a> duration.
178          </p></li></ul></div><p>
179       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
180        <code class="structfield">failover</code> <code class="type">bool</code>
181       </p>
182       <p>
183        True if this is a logical slot enabled to be synced to the standbys
184        so that logical replication can be resumed from the new primary
185        after failover. Always false for physical slots.
186       </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
187        <code class="structfield">synced</code> <code class="type">bool</code>
188       </p>
189       <p>
190        True if this is a logical slot that was synced from a primary server.
191        On a hot standby, the slots with the synced column marked as true can
192        neither be used for logical decoding nor dropped manually. The value
193        of this column has no meaning on the primary server; the column value on
194        the primary is default false for all slots but may (if leftover from a
195        promoted standby) also be true.
196       </p></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="view-pg-replication-origin-status.html" title="53.19. pg_replication_origin_status">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="views.html" title="Chapter 53. System Views">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="view-pg-roles.html" title="53.21. pg_roles">Next</a></td></tr><tr><td width="40%" align="left" valign="top">53.19. <code class="structname">pg_replication_origin_status</code> </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"> 53.21. <code class="structname">pg_roles</code></td></tr></table></div></body></html>