select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / SYSTEM ADMINISTRATION FUNCTIONS

pg_wal_lsn_diff

Read PG 18 manual ↗

Calculates the difference in bytes (lsn1 - lsn2) between two write-ahead log locations.

Signatures & examples

pg_wal_lsn_diff ( lsn1 pg_lsn, lsn2 pg_lsn ) → numeric
Calculates the difference in bytes (lsn1 - lsn2) between two write-ahead log locations. This can be used with pg_stat_replication or some of the functions shown in Table 9.97 to get the replication lag.
Version history 8
  1. PG 18 → 19changed
  2. PG 17 → 18changed
  3. PG 16 → 17changed
  4. PG 15 → 16changed
  5. PG 14 → 15changed
  6. PG 13 → 14changed
  7. PG 12 → 13changed
  8. PG 9.6 → 10added

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source