AW: AW: Replication Testing- How to introduce a Lag

From: "Subramanian,Ramachandran" <ramachandran(dot)subramanian(at)alte-leipziger(dot)de>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: AW: AW: Replication Testing- How to introduce a Lag
Date: 2026-03-21 07:49:32
Message-ID: fa47fe18078043adbdfe007b7270ffd0@alte-leipziger.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> how can the last replayed be more than the last received?

It shouldn't be - but I don't understand your script, in particular which query is issused on which server.

[Subramanian,Ramachandran IT-md-db]
100% sure that I have screwed up some variables in my script

Look at "pg_stat_replication" on the primary server.

[Subramanian,Ramachandran IT-md-db]

Thank you so much!! So I do not have to go across multiple tables to collect the information.

It is all there in one table pg_stat_replication at the Primary server and we can look at it from A) Primary and also from B) Stand-by !!

If I just look at the write_lag columns, it would give me a good idea of the situation -- Is my understanding correct ?

LG

Ram

Details from the Source (Remote Primary)
----------------------------------------------------------

pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start
| backend_xmin | state | sent_lsn | write_lsn | flush_lsn | replay_lsn | write_lag | flush_lag | replay
_lag | sync_priority | sync_state | reply_time
--------+----------+------------+------------------+-------------+-----------------+-------------+-----------------------------
--+--------------+-----------+------------+------------+------------+------------+-----------------+-----------------+---------
--------+---------------+------------+-------------------------------
188833 | 25200 | replicator | walreceiver | 10.10.10.10 | | 43330 | 2026-03-21 08:11:37.010895+0
1 | | streaming | 0/49072590 | 0/49072590 | 0/49072590 | 0/49042F98 | 00:00:00.000463 | 00:00:00.001693 | 00:00:27
.042262 | 0 | async | 2026-03-21 08:12:19.239535+01
(1 row)

The same details from the Local Stand-by Server -- They match !!!!
----------------------------------------------------------------------------------

pg_last_wal_receive_lsn
-------------------------
0/49072590
(1 row)

pg_last_wal_replay_lsn
------------------------
0/49042F98
(1 row)

Freundliche Grüße

i. A. Ramachandran Subramanian
Zentralbereich Informationstechnologie

Alte Leipziger Lebensversicherung a.G.

Hallesche Krankenversicherung a.G.

Alte Leipziger Lebensversicherung a.G., Alte Leipziger-Platz 1, 61440 Oberursel
Vors. des Aufsichtsrats: Dr. Walter Botermann · Vorstand: Christoph Bohn (Vors.), Dr. Jürgen Bierbaum (stv. Vors.), Frank Kettnaker, Dr. Jochen Kriegmeier, Alexander Mayer, Christian Pape, Wiltrud Pekarek, Udo Wilcsek
Sitz Oberursel (Taunus) · Rechtsform VVaG · Amtsgericht Bad Homburg v. d. H. HRB 1583 · USt.-IdNr. DE 114106814


Hallesche Krankenversicherung a.G., Löffelstraße 34-38, 70597 Stuttgart
Vors. des Aufsichtsrats: Dr. Walter Botermann · Vorstand: Christoph Bohn (Vors.), Dr. Jürgen Bierbaum (stv. Vors.), Frank Kettnaker, Dr. Jochen Kriegmeier, Alexander Mayer, Christian Pape,
Wiltrud Pekarek, Udo Wilcsek
Sitz Stuttgart · Rechtsform VVaG · Amtsgericht Stuttgart HRB 2686 · USt.-IdNr. DE 147802285
Beiträge zu privaten Kranken- und Pflegekrankenversicherungen unterliegen nicht der Versicherungsteuer (§ 4 Nr. 5 VersStG) · Versicherungsleistungen sowie Umsätze aus Versicherungsvertreter-/Maklertätigkeiten sind umsatzsteuerfrei


Die Pflichtangaben der ALH Gruppe gemäß § 35a GmbHG bzw. § 80 AktG finden Sie hier: https://www.alte-leipziger.de/impressum

______________________

ALH Gruppe
Alte Leipziger-Platz 1, 61440 Oberursel
Tel.: +49 (6171) 66-4882
Fax: +49 (6171) 66-800-4882
E-Mail: ramachandran(dot)subramanian(at)alte-leipziger(dot)de
www.alte-leipziger.de
www.hallesche.de

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Laurenz Albe 2026-03-21 08:43:10 Re: AW: AW: Replication Testing- How to introduce a Lag
Previous Message Laurenz Albe 2026-03-20 15:27:33 Re: Interested in contributing to PostgreSQL documentation and technical writing