pg_stat_replication_slots
一个统计视图,显示有关逻辑复制槽使用情况的统计信息
pg_stat_replication_slots
是一个 统计视图,显示有关逻辑复制槽使用情况的统计信息,特别是有关从 ReorderBuffer
溢出到磁盘的事务。
pg_stat_replication_slots
在 PostgreSQL 14 中添加。
重置统计信息
可以通过调用函数 pg_stat_reset_replication_slot(slot_name)
重置特定逻辑复制槽的统计信息。
可以通过调用 pg_stat_reset_replication_slot(NULL)
重置所有逻辑复制槽的统计信息。
按 PostgreSQL 版本定义
pg_stat_replication_slots (PostgreSQL 17)
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 | | |
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 | | |
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 | | |
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 | | |
更改历史记录
- PostgreSQL 14
- 添加(初始提交 98681675)
示例
订阅正在同步时 pg_stat_replication_slots
的示例内容
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 |
参考
- PostgreSQL 文档: pg_stat_replication_slots