3 ms·
Couldn't you just query the replication log positions on the primary and standbys and calculate their delta? I asked this to ChatGPT 4 and it suggested somethi
by bhouston 3y ago
Couldn't you just query the replication log positions on the primary and standbys and calculate their delta?
I asked this to ChatGPT 4 and it suggested something like this that seems reasonable:
Get it from the main server: SELECT * FROM pg_stat_replication, and the write_ls column has the log transaction location; Then get the location of the replication log and how much has been received: SELECT pg_last_wal_receive_lsn(); Then you can figure out the delta from any of these: SELECT pg_wal_lsn_diff(write_ls, pg_last_wal_receive_lsn()); or similar.
That seems like it isn't a hack.