pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: kaido vaikla <kaido.vaikla@gmail.com>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Replica and transaction
Date: Wed, 19 Feb 2025 09:51:49 +0100
Message-ID: <a19268d0f8620688d2b165cd71ad38f06a246d8e.camel@cybertec.at> (raw)
In-Reply-To: <CA+427g-91rw4Rb=+Hd2Y4jaqVMK=LViN2Pun=4TV+KhqgBi8_Q@mail.gmail.com>
References: <CA+427g-91rw4Rb=+Hd2Y4jaqVMK=LViN2Pun=4TV+KhqgBi8_Q@mail.gmail.com>

On Tue, 2025-02-18 at 18:59 +0200, kaido vaikla wrote:
> I found a statement:
> 
> Long-running transactions can cause replication lag because the changes made by
> these transactions are not replicated until the transaction is committed.
> (https://www.percona.com/blog/replication-lag-in-postgresql/)
> 
> 
> It means:
> change made by transaction is not replicated until the transaction is committed?
> 
> And for example
> time0: wal on primary
> time1: tx1 begin
> time2: tx2 begin
> time3: tx2 rollback
> time4: tx3 begin
> time5: tx3 commit
> time6: tx1 commit
> time7: walsender sends tx1, tx3 to replica, tx2 skipped because rollback
> ?

I'd say that the article is talking about streaming replication, and the
statement is manifestly wrong in the context of streaming replication.
All changes, no matter if they are committed or not, will be replicated
right away.  They just don't become *visible* before the COMMIT is replayed.

With logical replication, uncommitted changes are not replicated unless
the subscription was created with "streaming" set to something else than
"off".

Yours,
Laurenz Albe

-- 

*E-Mail Disclaimer*
Der Inhalt dieser E-Mail ist ausschliesslich fuer den 
bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat 
dieser E-Mail oder dessen Vertreter sein sollten, so beachten Sie bitte, 
dass jede Form der Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder 
Weitergabe des Inhalts dieser E-Mail unzulaessig ist. Wir bitten Sie, sich 
in diesem Fall mit dem Absender der E-Mail in Verbindung zu setzen.

*CONFIDENTIALITY NOTICE & DISCLAIMER
*This message and any attachment are 
confidential and may be privileged or otherwise protected from disclosure 
and solely for the use of the person(s) or entity to whom it is intended. 
If you have received this message in error and are not the intended 
recipient, please notify the sender immediately and delete this message and 
any attachment from your system. If you are not the intended recipient, be 
advised that any use of this message is prohibited and may be unlawful, and 
you must not copy this message or attachment or disclose the contents to 
any other person.





view thread (2+ messages)

Message-ID: <a19268d0f8620688d2b165cd71ad38f06a246d8e.camel@cybertec.at>
Permalink:  ../a19268d0f8620688d2b165cd71ad38f06a246d8e.camel@cybertec.at/
Also on:    postgresql.org/message-id/a19268d0f8620688d2b165cd71ad38f06a246d8e.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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: laurenz.albe@cybertec.at, kaido.vaikla@gmail.com
  Subject: Re: Replica and transaction
  In-Reply-To: <a19268d0f8620688d2b165cd71ad38f06a246d8e.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