Is it possible to find out write_lsn on standby?

Started by godjan •over 5 years ago2 messages
#1godjan •
g0dj4n@gmail.com

On primary I can execute ’SELECT write_lsn FROM pg_stat_replication;’ and get write_lsn of standby.
I didn’t find function like "pg_last_write_lsn()” to get write_lsn on standby. Is it possible?

In reply to: godjan • (#1)
Re: Is it possible to find out write_lsn on standby?

Hello,

On Fri, 8 May 2020 18:25:02 +0500
godjan • <g0dj4n@gmail.com> wrote:

On primary I can execute ’SELECT write_lsn FROM pg_stat_replication;’ and get
write_lsn of standby. I didn’t find function like "pg_last_write_lsn()” to
get write_lsn on standby. Is it possible?

No, there's no admin function exposing it. The closest one is
pg_last_wal_receive_lsn() which is related to pg_stat_replication.flush_lsn.

There was discussions to create eg. pg_stat_wal_receiver view few weeks/moth
ago. But this is nowhere close to something. No patch ready yet.

Regards,