# 54.19. pg\_replication\_slots

The `pg_replication_slots` view provides a listing of all replication slots that currently exist on the database cluster, along with their current state.

For more on replication slots, see [Section 27.2.6](https://www.postgresql.org/docs/current/warm-standby.html#STREAMING-REPLICATION-SLOTS) and [Chapter 49](https://www.postgresql.org/docs/current/logicaldecoding.html).

#### **Table 54.19. `pg_replication_slots` Columns**

| <p>Column Type</p><p>Description</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>slot\_name</code> <code>name</code></p><p>A unique, cluster-wide identifier for the replication slot</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| <p><code>plugin</code> <code>name</code></p><p>The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| <p><code>slot\_type</code> <code>text</code></p><p>The slot type: <code>physical</code> or <code>logical</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| <p><code>datoid</code> <code>oid</code> (references <a href="https://www.postgresql.org/docs/current/catalog-pg-database.html"><code>pg\_database</code></a>.<code>oid</code>)</p><p>The OID of the database this slot is associated with, or null. Only logical slots have an associated database.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>database</code> <code>name</code> (references <a href="https://www.postgresql.org/docs/current/catalog-pg-database.html"><code>pg\_database</code></a>.<code>datname</code>)</p><p>The name of the database this slot is associated with, or null. Only logical slots have an associated database.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| <p><code>temporary</code> <code>bool</code></p><p>True if this is a temporary replication slot. Temporary slots are not saved to disk and are automatically dropped on error or when the session has finished.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <p><code>active</code> <code>bool</code></p><p>True if this slot is currently actively being used</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| <p><code>active\_pid</code> <code>int4</code></p><p>The process ID of the session using this slot if the slot is currently actively being used. <code>NULL</code> if inactive.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <p><code>xmin</code> <code>xid</code></p><p>The oldest transaction that this slot needs the database to retain. <code>VACUUM</code> cannot remove tuples deleted by any later transaction.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <p><code>catalog\_xmin</code> <code>xid</code></p><p>The oldest transaction affecting the system catalogs that this slot needs the database to retain. <code>VACUUM</code> cannot remove catalog tuples deleted by any later transaction.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| <p><code>restart\_lsn</code> <code>pg\_lsn</code></p><p>The address (<code>LSN</code>) of oldest WAL which still might be required by the consumer of this slot and thus won't be automatically removed during checkpoints unless this LSN gets behind more than <a href="https://www.postgresql.org/docs/current/runtime-config-replication.html#GUC-MAX-SLOT-WAL-KEEP-SIZE">max\_slot\_wal\_keep\_size</a> from the current LSN. <code>NULL</code> if the <code>LSN</code> of this slot has never been reserved.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <p><code>confirmed\_flush\_lsn</code> <code>pg\_lsn</code></p><p>The address (<code>LSN</code>) up to which the logical slot's consumer has confirmed receiving data. Data older than this is not available anymore. <code>NULL</code> for physical slots.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <p><code>wal\_status</code> <code>text</code></p><p>Availability of WAL files claimed by this slot. Possible values are:</p><ul><li><code>reserved</code> means that the claimed files are within <code>max\_wal\_size</code>.</li><li><code>extended</code> means that <code>max\_wal\_size</code> is exceeded but the files are still retained, either by the replication slot or by <code>wal\_keep\_size</code>.</li><li><code>unreserved</code> means that the slot no longer retains the required WAL files and some of them are to be removed at the next checkpoint. This state can return to <code>reserved</code> or <code>extended</code>.</li><li><code>lost</code> means that some required WAL files have been removed and this slot is no longer usable.</li></ul><p>The last two states are seen only when <a href="https://www.postgresql.org/docs/current/runtime-config-replication.html#GUC-MAX-SLOT-WAL-KEEP-SIZE">max\_slot\_wal\_keep\_size</a> is non-negative. If <code>restart\_lsn</code> is NULL, this field is null.</p> |
| <p><code>safe\_wal\_size</code> <code>int8</code></p><p>The number of bytes that can be written to WAL such that this slot is not in danger of getting in state "lost". It is NULL for lost slots, as well as if <code>max\_slot\_wal\_keep\_size</code> is <code>-1</code>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>two\_phase</code> <code>bool</code></p><p>True if the slot is enabled for decoding prepared transactions. Always false for physical slots.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
