Updated on 2024-05-07 GMT+08:00

PG_REPLICATION_SLOTS

PG_REPLICATION_SLOTS displays replication slot information.

Table 1 PG_REPLICATION_SLOTS columns

Name

Type

Description

slot_name

text

Replication slot name.

plugin

text

Name of the output plug-in corresponding to the logical replication slot.

slot_type

text

Replication slot type.
  • physical: physical replication slot.
  • logical: logical replication slot.

datoid

oid

OID of the database where the replication slot resides.

database

name

Name of the database where the replication slot resides.

active

boolean

Determines whether the replication slot is activated.
  • t (true): yes.
  • f (false): no.

xmin

xid

XID of the earliest transaction that the database must reserve for the replication slot.

catalog_xmin

xid

XID of the earliest system catalog-involved transaction that the database must reserve for the logical replication slot.

restart_lsn

text

Physical location of the earliest Xlog required by the replication slot.

dummy_standby

boolean

Reserved parameter.

confirmed_flush

text

Dedicated logical replication slot. The client confirms the location of the received log.

confirmed_csn

xid

Dedicated logical replication slot. The client confirms the CSN corresponding to the last transaction in the received log.

Example:

-- Perform query on the DN.
gaussdb=# SELECT * FROM pg_replication_slots;
 slot_name |     plugin     | slot_type | datoid | database | active | xmin | catalog_xmin | restart_lsn | dummy_standby | confirmed_flush | confirmed_csn
-----------+----------------+-----------+--------+----------+--------+------+--------------+-------------+---------------+-----------------+---------------
 dn_6002   |                | physical  |      0 |          | t      |      |              | 0/3622B528  | f             |                 |
 dn_6003   |                | physical  |      0 |          | t      |      |              | 0/3622B528  | f             |                 |
 slot_lsn  | mppdb_decoding | logical   | 131072 | db_test  | f      |      |        66658 | 0/36252350  | f             | 0/362523D0      |
 slot_test | mppdb_decoding | logical   | 131072 | db_test  | f      |      |        66658 | 0/36251718  | f             |                 |      10025527
(4 rows)

-- Perform query on the CN.
gaussdb=# SELECT * FROM pg_replication_slots;
 slot_name |     plugin     | slot_type | datoid | database | active | xmin | catalog_xmin | restart_lsn | dummy_standby | confirmed_flush | confirmed_csn
-----------+----------------+-----------+--------+----------+--------+------+--------------+-------------+---------------+-----------------+---------------
 slot_test | mppdb_decoding | logical   | 139264 | db_test  | f      |      |              |             | f             |                 |
(1 row)

When a query is performed on a DN, the confirmed_csn query result of the LSN-based logical replication slot is empty, and the confirmed_flush query result of the CSN-based logical replication slot is empty. When a query is performed on the CN, catalog_xmin, restart_lsn, confirmed_flush, and confirmed_csn of the CSN-based logical replication slot are not displayed and the query result is empty.