Contents
pg_current_wal_flush_lsn()
A function returning the current WAL flush location
pg_current_wal_flush_lsn()
is a system function returning the current write-ahead log flush location.
pg_current_wal_flush_lsn()
was added in PostgreSQL 9.6 (as pg_current_xlog_flush_location()
).
Usage
pg_current_wal_flush_lsn () → pg_lsn
The flush location is the last WAL location known to be written to durable storage.
pg_current_wal_flush_lsn()
cannot be executed if PostgreSQL is in recovery (i.e. on a standby).
Change history
- PostgreSQL 10
- renamed to
pg_current_wal_flush_lsn()
(commit 806091c9)
- renamed to
- PostgreSQL 9.6
- added as
pg_current_xlog_flush_location()
(commit e63bb454)
- added as
Examples
Sample output from pg_current_wal_flush_lsn()
:
postgres=# SELECT pg_current_wal_flush_lsn(), pg_current_wal_lsn(), pg_current_wal_insert_lsn(); pg_current_wal_flush_lsn | pg_current_wal_lsn | pg_current_wal_insert_lsn --------------------------+--------------------+--------------------------- 4/2F000000 | 4/2F4C6000 | 4/2F8C4E78 (1 row)
Executing on a standby:
postgres=# SELECT pg_current_wal_flush_lsn(); ERROR: recovery is in progress HINT: WAL control functions cannot be executed during recovery.
References
- PostgreSQL documentation: Backup Control Functions
Categories
See also
pg_current_wal_lsn(), pg_current_wal_insert_lsn()