pg_stat_subscription_workers

A view showing logical replication subscription worker statistics
This entry relates to a PostgreSQL feature which is part of PostgreSQL 15, due to be released in late 2022.

pg_stat_subscription_workers is a statistics view showing information about logical replication subscription workers where an error has occurred.

pg_stat_subscription_workers was added in PostgreSQL 15.

Definition by PostgreSQL version

pg_stat_subscription_workers (PostgreSQL 15)

                 View "pg_catalog.pg_stat_subscription_workers"
       Column       |           Type           | Collation | Nullable | Default 
--------------------+--------------------------+-----------+----------+---------
 subid              | oid                      |           |          | 
 subname            | name                     |           |          | 
 subrelid           | oid                      |           |          | 
 last_error_relid   | oid                      |           |          | 
 last_error_command | text                     |           |          | 
 last_error_xid     | xid                      |           |          | 
 last_error_count   | bigint                   |           |          | 
 last_error_message | text                     |           |          | 
 last_error_time    | timestamp with time zone |           |          |
    

Documentation: pg_stat_subscription_workers

Change history

Examples

Sample contents of pg_stat_subscription_workers, here containing an error:

postgres=# SELECT * FROM pg_stat_subscription_workers;
-[ RECORD 1 ]------+----------------------------------------------------------------------------------------------
subid              | 16430
subname            | test_subscription
subrelid           | 16417
last_error_relid   | 16417
last_error_command | 
last_error_xid     | 
last_error_count   | 2
last_error_message | logical replication target relation "app.entry" is missing replicated column: "entry_display"
last_error_time    | 2021-11-30 22:46:32.333135+01

Note that any error information will remain until superseded by a subsequent error; it will not be cleared if the error is resolved.

Categories

Logical replication, Statistics / monitoring view, System catalogue

See also

pg_stat_subscription