pg_stat_subscription 是一个显示逻辑复制订阅的统计信息视图。
pg_stat_subscription 在 PostgreSQL 10 中添加。
按 PostgreSQL 版本定义
pg_stat_subscription (PostgreSQL 19)
View "pg_catalog.pg_stat_subscription"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
subid | oid | | |
subname | name | | |
worker_type | text | | |
pid | integer | | |
leader_pid | integer | | |
relid | oid | | |
received_lsn | pg_lsn | | |
last_msg_send_time | timestamp with time zone | | |
last_msg_receipt_time | timestamp with time zone | | |
latest_end_lsn | pg_lsn | | |
latest_end_time | timestamp with time zone | | |
pg_stat_subscription (PostgreSQL 18)
View "pg_catalog.pg_stat_subscription"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
subid | oid | | |
subname | name | | |
worker_type | text | | |
pid | integer | | |
leader_pid | integer | | |
relid | oid | | |
received_lsn | pg_lsn | | |
last_msg_send_time | timestamp with time zone | | |
last_msg_receipt_time | timestamp with time zone | | |
latest_end_lsn | pg_lsn | | |
latest_end_time | timestamp with time zone | | |
pg_stat_subscription (PostgreSQL 17)
View "pg_catalog.pg_stat_subscription"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
subid | oid | | |
subname | name | | |
worker_type | text | | |
pid | integer | | |
leader_pid | integer | | |
relid | oid | | |
received_lsn | pg_lsn | | |
last_msg_send_time | timestamp with time zone | | |
last_msg_receipt_time | timestamp with time zone | | |
latest_end_lsn | pg_lsn | | |
latest_end_time | timestamp with time zone | | |
pg_stat_subscription (PostgreSQL 16)
View "pg_catalog.pg_stat_subscription"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
subid | oid | | |
subname | name | | |
pid | integer | | |
leader_pid | integer | | |
relid | oid | | |
received_lsn | pg_lsn | | |
last_msg_send_time | timestamp with time zone | | |
last_msg_receipt_time | timestamp with time zone | | |
latest_end_lsn | pg_lsn | | |
latest_end_time | timestamp with time zone | | |
pg_stat_subscription (PostgreSQL 15)
View "pg_catalog.pg_stat_subscription"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
subid | oid | | |
subname | name | | |
pid | integer | | |
relid | oid | | |
received_lsn | pg_lsn | | |
last_msg_send_time | timestamp with time zone | | |
last_msg_receipt_time | timestamp with time zone | | |
latest_end_lsn | pg_lsn | | |
latest_end_time | timestamp with time zone | | |
pg_stat_subscription (PostgreSQL 14)
View "pg_catalog.pg_stat_subscription"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
subid | oid | | |
subname | name | | |
pid | integer | | |
relid | oid | | |
received_lsn | pg_lsn | | |
last_msg_send_time | timestamp with time zone | | |
last_msg_receipt_time | timestamp with time zone | | |
latest_end_lsn | pg_lsn | | |
latest_end_time | timestamp with time zone | | |
pg_stat_subscription (PostgreSQL 13)
View "pg_catalog.pg_stat_subscription"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
subid | oid | | |
subname | name | | |
pid | integer | | |
relid | oid | | |
received_lsn | pg_lsn | | |
last_msg_send_time | timestamp with time zone | | |
last_msg_receipt_time | timestamp with time zone | | |
latest_end_lsn | pg_lsn | | |
latest_end_time | timestamp with time zone | | |
pg_stat_subscription (PostgreSQL 12)
View "pg_catalog.pg_stat_subscription"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
subid | oid | | |
subname | name | | |
pid | integer | | |
relid | oid | | |
received_lsn | pg_lsn | | |
last_msg_send_time | timestamp with time zone | | |
last_msg_receipt_time | timestamp with time zone | | |
latest_end_lsn | pg_lsn | | |
latest_end_time | timestamp with time zone | | |
pg_stat_subscription (PostgreSQL 11)
View "pg_catalog.pg_stat_subscription"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
subid | oid | | |
subname | name | | |
pid | integer | | |
relid | oid | | |
received_lsn | pg_lsn | | |
last_msg_send_time | timestamp with time zone | | |
last_msg_receipt_time | timestamp with time zone | | |
latest_end_lsn | pg_lsn | | |
latest_end_time | timestamp with time zone | | |
pg_stat_subscription (PostgreSQL 10)
View "pg_catalog.pg_stat_subscription"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
subid | oid | | |
subname | name | | |
pid | integer | | |
relid | oid | | |
received_lsn | pg_lsn | | |
last_msg_send_time | timestamp with time zone | | |
last_msg_receipt_time | timestamp with time zone | | |
latest_end_lsn | pg_lsn | | |
latest_end_time | timestamp with time zone | | |
变更历史
- PostgreSQL 17
- 添加了
worker_type列(提交 13aeaf07)
- 添加了
- PostgreSQL 16
- 添加了
leader_pid列(提交 d540a02a)
- 添加了
- PostgreSQL 10
- 添加于 (提交 665d1fad)
示例
pg_stat_subscription 的示例内容
postgres=# SELECT * FROM pg_stat_subscription; -[ RECORD 1 ]---------+------------------------------ subid | 16404 subname | test_subscription pid | 6436 relid | received_lsn | 0/14ED8B8 last_msg_send_time | 2021-11-24 16:02:04.801319+01 last_msg_receipt_time | 2021-11-24 16:02:04.801549+01 latest_end_lsn | 0/14ED8B8 latest_end_time | 2021-11-24 16:02:04.801319+01
参考资料
- PostgreSQL 文档: pg_stat_subscription
