streaminglag
streaminglag · SQL helpers that convert WAL LSNs to integers and estimate primary-to-standby streaming replication lag in bytes.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100454 | streaminglag | streaminglag | 1.0 | STAT | BSD-2-Clause | SQL |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
streaminglag is a pure-SQL helper that converts WAL log sequence numbers to integers and subtracts two positions through pg_streaming_lag(text,text) or pg_streaming_lag(pg_lsn,pg_lsn). It was written for old pg_stat_replication column names and pre-PostgreSQL-9.4 text LSNs.
Do not use the extension result for correctness-sensitive monitoring. The reviewed SQL multiplies the high LSN half by hexadecimal ff000000, not 2^32, so it produces a wrong difference when the high halves differ. Modern PostgreSQL provides pg_wal_lsn_diff(pg_lsn,pg_lsn) and current replication views directly expose LSN positions.
The project is an abandoned 2014 version 1.0 with no release or maintenance history. Prefer the built-in function, retain this extension only for historical compatibility, and compare every result during migration before removing it.