Lag clarification with Sync Replication - Mailing list pgsql-admin

From Raj kumar
Subject Lag clarification with Sync Replication
Date
Msg-id CACxU--UqAsOuj+zViH3sjra-P6Z+gps7aOs2845F+_ehALF5yw@mail.gmail.com
Whole thread Raw
Responses Re: Lag clarification with Sync Replication  (Scott Ribe <scott_ribe@elevated-dev.com>)
Re: Lag clarification with Sync Replication  (Keith <keith@keithf4.com>)
Re: Lag clarification with Sync Replication  (Rui DeSousa <rui@crazybean.net>)
List pgsql-admin
I have made a synchronous replication setup with PG12.
During data loading of 200 gig in master node, I found that there is a lag that it shows on the slave. But, ideally for sync replication, lag should be always 0 right.
Because commit never happens in master before updating the slave.
 log_delay
------------
 871.549671
(1 row) log_delay
------------
 871.557246
(1 row) log_delay
-----------
         0
(1 row) log_delay
-----------
         0
(1 row)

Query Used for checking Standby Replication Lag:
psql -d perfbench -p 5432 -c "SELECT CASE WHEN pg_last_wal_receive_lsn() = pg_last_wal_replay_lsn()
THEN 0
ELSE EXTRACT (EPOCH FROM now() - pg_last_xact_replay_timestamp())
END AS log_delay;"

Setting Used in PG12

 cat postgresql.conf |grep synchronous_

synchronous_commit = remote_write                # synchronization level;

synchronous_standby_names = 'ANY 1 (standby1,standby2)'        # standby servers that provide sync rep


cat postgresql.conf |grep primary_conn

primary_conninfo = 'user=edbrepl host= 10.12.11.101 port=5432 application_name=standby1 '


Thanks,
Raj Kumar

pgsql-admin by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Suggestion on column cast automatically to data type
Next
From: postgann2020 s
Date:
Subject: Suggestion to improve query performance of data validation in proc.