All Products
Search
Document Center

PolarDB:pg_replication_slots

Last Updated:May 11, 2024

The pg_replication_slots view provides a list of all replication slots in the database cluster and the state of these replication slots.

Overview

The pg_replication_slots view contains the following columns:

Column name

Type

Description

slot_name

name

A unique, cluster-wide identifier for the replication slot.

plugin

name

The base name of the shared object containing the output plugin that the logical slot is using. This value is empty for physical slots.

slot_type

text

The type of the replication slot. Valid values: physical and logical.

datoid

oid

The OID of the database with which this slot is associated. This value is empty for physical slots. Only a logical slot have an associated database.

database

name

The name of the database with which this slot is associated. This value is empty for physical slots. Only a logical slot have an associated database.

temporary

bool

The value is true if this is a temporary replication slot. Otherwise, the value is false. Temporary slots are not saved to disk and are automatically removed when errors occur or when the session ends.

active

bool

The value is true if the replication slot is being used. Otherwise, the value is false.

active_pid

int4

The process ID of the session that uses this slot if the slot is being used. The value is NULL if the slot is inactive.

xmin

xid

The oldest transaction that this slot needs the database to retain. VACUUM cannot remove tuples deleted by any later transaction.

catalog_xmin

xid

The oldest transaction affecting the system catalogs that this slot needs the database to retain. VACUUM cannot remove catalog tuples deleted by any later transaction.

restart_lsn

pg_lsn

The address (LSN) of oldest WAL which still might be required by the consumer of this slot and won't be automatically removed during checkpoints. The value is NULL if the LSN of this slot has never been reserved.

confirmed_flush_lsn

pg_lsn

The address (LSN) to which the consumer of this slot has confirmed receiving data. Data corresponding to the transactions committed before this address is no longer available. The value is NULL for physical slots.

wal_status

text

The availability of WAL files claimed by this slot. Valid values:

  • reserved: The claimed files are smaller than the value of the max_wal_size parameter.

  • extended: The claimed files exceed the value of the max_wal_size parameter, but the files are still retained either by the replication slot or the wal_keep_size parameter.

  • unreserved: The slot no longer retains the required WAL files and some of the files are to be removed at the next checkpoint. This state can returned to reserved or extended.

  • lost: Some required WAL files are removed and this slot is no longer available.

Note

The unreserved and lost states are displayed only when the max_slot_wal_keep_size parameter is non-negative. If the value of restart_lsn is NULL, this value is empty.

safe_wal_size

int8

The number of bytes that can be written to WAL to ensure that this slot is not in the lost state. If the slot is in the lost state or the value of the max_slot_wal_keep_size parameter is -1, the value is NULL.