Re: Lag clarification with Sync Replication - Mailing list pgsql-admin

From Laurenz Albe
Subject Re: Lag clarification with Sync Replication
Date
Msg-id 34c00892d4434f4a02b9977c3e710361659d7e09.camel@cybertec.at
Whole thread Raw
In response to Re: Lag clarification with Sync Replication  (Rui DeSousa <rui@crazybean.net>)
List pgsql-admin
On Fri, 2020-05-22 at 12:48 -0400, Rui DeSousa wrote:
> > On May 22, 2020, at 12:36 AM, Raj kumar <rajkumar820999@gmail.com> wrote:
> > 
> > . But, ideally for sync replication, lag should be always 0 right.
> 
> Incorrect.  Synchronous replication means that a commit will not return until it has been safely written to disk on
theprimary and the replica.  That means the transaction is written to WAL file on
 
> both primary and replica.  On the primary, the transaction is also visible to transactions with a later xmin.  On the
replica,the transaction has been recorded in the WAL; it still needs to get
 
> applied to the database for it to become visible to read transactions.

If you set "synchronous_commit = remote_apply", the commit will only return
when the change has been replayed on the synchronous standby server.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




pgsql-admin by date:

Previous
From: Raj kumar
Date:
Subject: Re: Lag clarification with Sync Replication
Next
From: Laurenz Albe
Date:
Subject: Re: Request to help on Query improvement suggestion.