pg_stat_replication_slots
A statistics view showing statistics about logical replication slot usage
pg_stat_replication_slots
is a statistics view showing statistics about logical replication slot usage, specifically about transactions spilled to disk from the ReorderBuffer
.
pg_stat_replication_slots
was added in PostgreSQL 14.
Resetting statistics
Statistics for a particular logical replication slot can be reset by calling the function pg_stat_reset_replication_slot(slot_name)
.
Statistics for all logical replication slots can be reset by calling pg_stat_reset_replication_slot(NULL)
.
Definition by PostgreSQL version
pg_stat_replication_slots (PostgreSQL 16)
View "pg_catalog.pg_stat_replication_slots" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+--------- slot_name | text | | | spill_txns | bigint | | | spill_count | bigint | | | spill_bytes | bigint | | | stream_txns | bigint | | | stream_count | bigint | | | stream_bytes | bigint | | | total_txns | bigint | | | total_bytes | bigint | | | stats_reset | timestamp with time zone | | |
Documentation: pg_stat_replication_slots
pg_stat_replication_slots (PostgreSQL 15)
View "pg_catalog.pg_stat_replication_slots" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+--------- slot_name | text | | | spill_txns | bigint | | | spill_count | bigint | | | spill_bytes | bigint | | | stream_txns | bigint | | | stream_count | bigint | | | stream_bytes | bigint | | | total_txns | bigint | | | total_bytes | bigint | | | stats_reset | timestamp with time zone | | |
Documentation: pg_stat_replication_slots
pg_stat_replication_slots (PostgreSQL 14)
View "pg_catalog.pg_stat_replication_slots" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+--------- slot_name | text | | | spill_txns | bigint | | | spill_count | bigint | | | spill_bytes | bigint | | | stream_txns | bigint | | | stream_count | bigint | | | stream_bytes | bigint | | | total_txns | bigint | | | total_bytes | bigint | | | stats_reset | timestamp with time zone | | |
Documentation: pg_stat_replication_slots
Change history
- PostgreSQL 14
- added (initial commit 98681675)
Examples
Example contents of pg_stat_replication_slots
while a subscription is being synchronized:
postgres=# SELECT * FROM pg_stat_replication_slots\gx -[ RECORD 1 ]+----------------------------------------- slot_name | test_subscription spill_txns | 0 spill_count | 0 spill_bytes | 0 stream_txns | 0 stream_count | 0 stream_bytes | 0 total_txns | 0 total_bytes | 0 stats_reset | -[ RECORD 2 ]+----------------------------------------- slot_name | pg_131705_sync_16417_7036528642179786015 spill_txns | 0 spill_count | 0 spill_bytes | 0 stream_txns | 0 stream_count | 0 stream_bytes | 0 total_txns | 0 total_bytes | 0 stats_reset |
References
- PostgreSQL documentation: pg_stat_replication_slots