pg_stat_wal_receiver

A statistics view displaying information about the local server's WAL receiver

pg_stat_wal_receiver is a statistics view displaying information about the server's WAL receiver, if running.

pg_stat_wal_receiver was introduced in PostgreSQL 9.6.

Source code

pg_stat_wal_receiver is based on the internal system function pg_stat_get_wal_receiver(), defined in src/backend/replication/walreceiver.c.

Definition by PostgreSQL version

pg_stat_wal_receiver (PostgreSQL 13)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          |
 status                | text                     |           |          |
 receive_start_lsn     | pg_lsn                   |           |          |
 receive_start_tli     | integer                  |           |          |
 received_lsn          | pg_lsn                   |           |          |
 received_tli          | integer                  |           |          |
 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 |           |          |
 slot_name             | text                     |           |          |
 sender_host           | text                     |           |          |
 sender_port           | integer                  |           |          |
 conninfo              | text                     |           |          |
    

Documentation: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 12)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          |
 status                | text                     |           |          |
 receive_start_lsn     | pg_lsn                   |           |          |
 receive_start_tli     | integer                  |           |          |
 received_lsn          | pg_lsn                   |           |          |
 received_tli          | integer                  |           |          |
 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 |           |          |
 slot_name             | text                     |           |          |
 sender_host           | text                     |           |          |
 sender_port           | integer                  |           |          |
 conninfo              | text                     |           |          |
    

Documentation: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 11)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          |
 status                | text                     |           |          |
 receive_start_lsn     | pg_lsn                   |           |          |
 receive_start_tli     | integer                  |           |          |
 received_lsn          | pg_lsn                   |           |          |
 received_tli          | integer                  |           |          |
 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 |           |          |
 slot_name             | text                     |           |          |
 sender_host           | text                     |           |          |
 sender_port           | integer                  |           |          |
 conninfo              | text                     |           |          |
    

Documentation: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 10)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          |
 status                | text                     |           |          |
 receive_start_lsn     | pg_lsn                   |           |          |
 receive_start_tli     | integer                  |           |          |
 received_lsn          | pg_lsn                   |           |          |
 received_tli          | integer                  |           |          |
 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 |           |          |
 slot_name             | text                     |           |          |
 conninfo              | text                     |           |          |
    

Documentation: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 9.6)

            View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Modifiers
-----------------------+--------------------------+-----------
 pid                   | integer                  |
 status                | text                     |
 receive_start_lsn     | pg_lsn                   |
 receive_start_tli     | integer                  |
 received_lsn          | pg_lsn                   |
 received_tli          | integer                  |
 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 |
 slot_name             | text                     |
 conninfo              | text                     |
    

Documentation: pg_stat_wal_receiver

Change history

Examples

-[ RECORD 1 ]---------+----------------------------------------------------------------------
pid                   | 99636
status                | streaming
receive_start_lsn     | 0/3000000
receive_start_tli     | 1
received_lsn          | 0/3001FE0
received_tli          | 1
last_msg_send_time    | 2019-06-01 15:57:46.097546+02
last_msg_receipt_time | 2019-06-01 15:57:46.097761+02
latest_end_lsn        | 0/3001FE0
latest_end_time       | 2019-06-01 15:43:14.741461+02
slot_name             | 
sender_host           | node1
sender_port           | 5432
conninfo              | user=postgres dbname=replication host=node1 port=5432
                        application_name=node2 fallback_application_name=walreceiver 

Note: "status" can be one of:

  • stopped (WALRCV_STOPPED)
  • starting (WALRCV_STARTING)
  • streaming (WALRCV_STREAMING)
  • waiting (WALRCV_WAITING)
  • restarting (WALRCV_RESTARTING)
  • stopping (WALRCV_STOPPING)

See function WalRcvGetStateString() in src/backend/replication/walreceiver.c.

Categories

Replication, Statistics / monitoring view, WAL

See also

pg_stat_replication