pg_replication_slots
pg_replication_slots
is a system catalogue view listing all replication slots.
pg_replication_slots
was added in PostgreSQL 9.4.
Usage
The function underlying pg_replication_slots
reads the replication slot on-disk structures directly, meaning the contents of this view are always visible regardless of transaction status, and may change within a transaction. Care should therefore be taken when combining it with other relations such as pg_stat_activity
, as the contents of those may not be visible to the current transaction.
Definition by PostgreSQL version
pg_replication_slots (PostgreSQL 16)
View "pg_catalog.pg_replication_slots" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+--------- slot_name | name | | | plugin | name | | | slot_type | text | | | datoid | oid | | | database | name | | | temporary | boolean | | | active | boolean | | | active_pid | integer | | | xmin | xid | | | catalog_xmin | xid | | | restart_lsn | pg_lsn | | | confirmed_flush_lsn | pg_lsn | | | wal_status | text | | | safe_wal_size | bigint | | | two_phase | boolean | | |
Documentation: pg_replication_slots
pg_replication_slots (PostgreSQL 15)
View "pg_catalog.pg_replication_slots" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+--------- slot_name | name | | | plugin | name | | | slot_type | text | | | datoid | oid | | | database | name | | | temporary | boolean | | | active | boolean | | | active_pid | integer | | | xmin | xid | | | catalog_xmin | xid | | | restart_lsn | pg_lsn | | | confirmed_flush_lsn | pg_lsn | | | wal_status | text | | | safe_wal_size | bigint | | | two_phase | boolean | | |
Documentation: pg_replication_slots
pg_replication_slots (PostgreSQL 14)
View "pg_catalog.pg_replication_slots" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+--------- slot_name | name | | | plugin | name | | | slot_type | text | | | datoid | oid | | | database | name | | | temporary | boolean | | | active | boolean | | | active_pid | integer | | | xmin | xid | | | catalog_xmin | xid | | | restart_lsn | pg_lsn | | | confirmed_flush_lsn | pg_lsn | | | wal_status | text | | | safe_wal_size | bigint | | | two_phase | boolean | | |
Documentation: pg_replication_slots
pg_replication_slots (PostgreSQL 13)
View "pg_catalog.pg_replication_slots" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+--------- slot_name | name | | | plugin | name | | | slot_type | text | | | datoid | oid | | | database | name | | | temporary | boolean | | | active | boolean | | | active_pid | integer | | | xmin | xid | | | catalog_xmin | xid | | | restart_lsn | pg_lsn | | | confirmed_flush_lsn | pg_lsn | | | wal_status | text | | | safe_wal_size | bigint | | |
Documentation: pg_replication_slots
pg_replication_slots (PostgreSQL 12)
View "pg_catalog.pg_replication_slots" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+--------- slot_name | name | | | plugin | name | | | slot_type | text | | | datoid | oid | | | database | name | | | temporary | boolean | | | active | boolean | | | active_pid | integer | | | xmin | xid | | | catalog_xmin | xid | | | restart_lsn | pg_lsn | | | confirmed_flush_lsn | pg_lsn | | |
Documentation: pg_replication_slots
pg_replication_slots (PostgreSQL 11)
View "pg_catalog.pg_replication_slots" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+--------- slot_name | name | | | plugin | name | | | slot_type | text | | | datoid | oid | | | database | name | | | temporary | boolean | | | active | boolean | | | active_pid | integer | | | xmin | xid | | | catalog_xmin | xid | | | restart_lsn | pg_lsn | | | confirmed_flush_lsn | pg_lsn | | |
Documentation: pg_replication_slots
pg_replication_slots (PostgreSQL 10)
View "pg_catalog.pg_replication_slots" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+--------- slot_name | name | | | plugin | name | | | slot_type | text | | | datoid | oid | | | database | name | | | temporary | boolean | | | active | boolean | | | active_pid | integer | | | xmin | xid | | | catalog_xmin | xid | | | restart_lsn | pg_lsn | | | confirmed_flush_lsn | pg_lsn | | |
Documentation: pg_replication_slots
pg_replication_slots (PostgreSQL 9.6)
View "pg_catalog.pg_replication_slots" Column | Type | Modifiers ---------------------+---------+----------- slot_name | name | plugin | name | slot_type | text | datoid | oid | database | name | active | boolean | active_pid | integer | xmin | xid | catalog_xmin | xid | restart_lsn | pg_lsn | confirmed_flush_lsn | pg_lsn |
Documentation: pg_replication_slots
pg_replication_slots (PostgreSQL 9.5)
View "pg_catalog.pg_replication_slots" Column | Type | Modifiers --------------+---------+----------- slot_name | name | plugin | name | slot_type | text | datoid | oid | database | name | active | boolean | active_pid | integer | xmin | xid | catalog_xmin | xid | restart_lsn | pg_lsn |
Documentation: pg_replication_slots
pg_replication_slots (PostgreSQL 9.4)
View "pg_catalog.pg_replication_slots" Column | Type | Modifiers --------------+---------+----------- slot_name | name | plugin | name | slot_type | text | datoid | oid | database | name | active | boolean | xmin | xid | catalog_xmin | xid | restart_lsn | pg_lsn |
Documentation: pg_replication_slots
Change history
- PostgreSQL 14
- column
two_phase
added (commit 19890a06)
- column
- PostgreSQL 13
- PostgreSQL 10
- column
temporary
added (commit a924c327)
- column
- PostgreSQL 9.6
- column
confirmed_flush_lsn
added (commit 3f811c2d)
- column
- PostgreSQL 9.5
- column
active_pid
added (commit d811c037)
- column
- PostgreSQL 9.4
- added (commit 858ec118)
Examples
Sample contents of pg_replication_slots
(as of PostgreSQL 13) when a single physical replication slot is in use:
postgres=# SELECT * FROM pg_replication_slots\gx -[ RECORD 1 ]-------+-------------- slot_name | node2 plugin | slot_type | physical datoid | database | temporary | f active | t active_pid | 1597000 xmin | catalog_xmin | restart_lsn | 0/3002470 confirmed_flush_lsn | wal_status | reserved safe_wal_size |
References
- PostgreSQL documentation: pg_replication_slots