Thread: Is it possible to find out write_lsn on standby?

Is it possible to find out write_lsn on standby?

From
godjan •
Date:
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?


Re: Is it possible to find out write_lsn on standby?

From
Jehan-Guillaume de Rorthais
Date:
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,