pg_stat_subscription
是一个显示逻辑复制订阅的统计视图。
pg_stat_subscription
在 PostgreSQL 10 中添加。
按 PostgreSQL 版本定义
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