Re: Synchronous replication and read consistency

From: Chris Mair <chris(at)1006(dot)org>
To: Ravi Krishna <sravikrishna3(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, jd(at)commandprompt(dot)com
Subject: Re: Synchronous replication and read consistency
Date: 2015-07-29 19:19:55
Message-ID: e140b14d6593a417416f2399b5b667c4@smtp.hushmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Chris/Joshua
>
> I would like to know more details.
>
> As per this:
>
> http://www.postgresql.org/docs/current/static/warm-standby.html#SYNCHRONOUS-REPLICATION
>
> "When requesting synchronous replication, each commit of a write
> transaction will wait until confirmation is received that the commit
> has been written to the transaction log on disk of both the primary
> and standby server."
>

Ah, sorry I misread sync replication as streaming replication...

> Does it mean that, on the standby, when PG writes the transaction log
> on the disk, it also updates the data buffers to make the transaction
> visible for all sessions.
>
> Eg:
>
> On the primary
> A big transaction committed
> Now if I issue a select on the primary looking for the transaction I
> committed above, I will get what I want.
> Will I get the same result if instead of primary I issue the select on
> the standby.
>
> Hope it is clear.

Synchronous replication is slower by nature. It will slow down the
master as well because each commit has to wait for a standby to ack it.

The answer to your question is still yes, you will get the same result
on the standby.

You will actually see less lag than with normal streaming replication
in the sense that the standby lagging several transactions behind due to
a commit/write burst on the master is not possible anymore. This
is of course at the expense of master-performance.

Bye,
Chris.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message AI Rumman 2015-07-29 19:33:55 Re: Postgresql upgrade from 8.4 to latest
Previous Message CS DBA 2015-07-29 19:13:15 xmin horizon?