pg_last_wal_replay_lsn()

A function returning the most recent WAL location replayed a standby

pg_last_wal_replay_lsn() is a system function returning the most recent WAL location that has been replayed by a streaming replication standby.

pg_last_wal_replay_lsn() was added in PostgreSQL 9.0 as pg_last_xlog_replay_location().

Usage

pg_last_wal_replay_lsn() → pg_lsn

Change history

Examples

Basic usage example for pg_last_wal_replay_lsn():

postgres=# SELECT pg_last_wal_replay_lsn();
 pg_last_wal_replay_lsn 
------------------------
 7/9E02D4D8
(1 row)

This value is also reported via the replay_lsn column in the upstream node's pg_stat_replication entry for the standby:

postgres=# SELECT replay_lsn FROM pg_stat_replication WHERE application_name='node2';
 replay_lsn 
------------
 7/9E02D4D8
(1 row)

Categories

Replication, System function, WAL

See also

pg_last_wal_receive_lsn()