film42 / pgreba

A health-checking service for postgres
2 stars 5 forks source link

Local replay lag #17

Open film42 opened 3 years ago

film42 commented 3 years ago
postgres=# select (pg_last_wal_receive_lsn() - pg_last_wal_replay_lsn()) / 1024^3 as lag_in_gb;
     lag_in_gb      
--------------------
 10.330981984734535
(1 row)

I wonder if we can use something like ^^ to capture the local replay lag. This might be useful if a replica was restarted with replay lag. The replication slot will remain inactive until the local replay has caught up (I think that's right). Adding a local replay lag to the json response could be nice.