public inbox for pgsql-novice@postgresql.org  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Subramanian,Ramachandran <ramachandran.subramanian@alte-leipziger.de>
To: pgsql-novice@lists.postgresql.org <pgsql-novice@lists.postgresql.org>
Subject: Re: AW: AW: AW: Replication Testing- How to introduce a Lag
Date: Mon, 23 Mar 2026 15:33:29 +0100
Message-ID: <0e00fcc0062b59b88f98dba4900ce49d5a9a3fea.camel@cybertec.at> (raw)
In-Reply-To: <fc3be1f56ded49dc9be519f92d8b9ab4@alte-leipziger.de>
References: <aadb9058660d4e10b5cee44b82458802@alte-leipziger.de>
	<f3927bc3a9baf4400325b91652869907f0581c97.camel@cybertec.at>
	<e1e41761323040228570cf6a7e02518e@alte-leipziger.de>
	<8b38fa5141905f9ad6983b8d5ae944e812e3d28a.camel@cybertec.at>
	<fa47fe18078043adbdfe007b7270ffd0@alte-leipziger.de>
	<fc42f77c80fdb3c0267148b807edfacc49b0b0ca.camel@cybertec.at>
	<fc3be1f56ded49dc9be519f92d8b9ab4@alte-leipziger.de>

On Mon, 2026-03-23 at 05:55 +0000, Subramanian,Ramachandran wrote:
> Thank you so much for your guidance,  Today morning I noticed the columns being null .  
> 
> > streaming | 0/491179E8 | 0/491179E8 | 0/491179E8 | 0/491179E8 |           |           |            |
> 
> Does it make sense to use the below SQL as a primary health check ?
> 
> [postgres@Source_server~]$ psql -p 5432 -c " select  pg_wal_lsn_diff(sent_lsn,replay_lsn) from pg_stat_replication"
>  pg_wal_lsn_diff
> -----------------
>                0
> (1 row)

No; you want to measure the lag between the primary's current WAL position and
what was already replayed on the standby:

  SELECT pg_wal_lsn_diff(pg_current_wal_lsn(), replay_lsn)
  FROM pg_stat_replication;

Yours,
Laurenz Albe





reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-novice@postgresql.org
  Cc: laurenz.albe@cybertec.at, ramachandran.subramanian@alte-leipziger.de, pgsql-novice@lists.postgresql.org
  Subject: Re: AW: AW: AW: Replication Testing- How to introduce a Lag
  In-Reply-To: <0e00fcc0062b59b88f98dba4900ce49d5a9a3fea.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox