pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Rui DeSousa <rui@crazybean.net>
To: Raj kumar <rajkumar820999@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Lag clarification with Sync Replication
Date: Mon, 25 May 2020 08:42:07 +0200
Message-ID: <34c00892d4434f4a02b9977c3e710361659d7e09.camel@cybertec.at> (raw)
In-Reply-To: <D74DE8AA-43E2-45DC-B76D-86C3C0C6437C@crazybean.net>
References: <CACxU--UqAsOuj+zViH3sjra-P6Z+gps7aOs2845F+_ehALF5yw@mail.gmail.com>
	<D74DE8AA-43E2-45DC-B76D-86C3C0C6437C@crazybean.net>

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 the primary 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






view thread (6+ messages)

Message-ID: <34c00892d4434f4a02b9977c3e710361659d7e09.camel@cybertec.at>
Permalink:  ../34c00892d4434f4a02b9977c3e710361659d7e09.camel@cybertec.at/
Also on:    postgresql.org/message-id/34c00892d4434f4a02b9977c3e710361659d7e09.camel@cybertec.at

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: laurenz.albe@cybertec.at, rui@crazybean.net, rajkumar820999@gmail.com
  Subject: Re: Lag clarification with Sync Replication
  In-Reply-To: <34c00892d4434f4a02b9977c3e710361659d7e09.camel@cybertec.at>
  References: <CACxU--UqAsOuj+zViH3sjra-P6Z+gps7aOs2845F+_ehALF5yw@mail.gmail.com> <D74DE8AA-43E2-45DC-B76D-86C3C0C6437C@crazybean.net> <34c00892d4434f4a02b9977c3e710361659d7e09.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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox