Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tkfoC-005rSD-43 for pgsql-admin@arkaria.postgresql.org; Wed, 19 Feb 2025 08:51:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tkfoA-0067x4-KT for pgsql-admin@arkaria.postgresql.org; Wed, 19 Feb 2025 08:51:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tkfoA-0067ww-8T for pgsql-admin@lists.postgresql.org; Wed, 19 Feb 2025 08:51:54 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tkfo7-001jLB-30 for pgsql-admin@postgresql.org; Wed, 19 Feb 2025 08:51:54 +0000 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-abb79af88afso719615766b.1 for ; Wed, 19 Feb 2025 00:51:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1739955111; x=1740559911; darn=postgresql.org; h=mime-version:user-agent:references:in-reply-to:date:to:from:subject :message-id:from:to:cc:subject:date:message-id:reply-to; bh=1LTtvVEAcWvwAzgNulpFuZH+/VUybcJLZgbrwVSKwtY=; b=YPfr+gBaCyf0ZeytDijXvHQ17ZhlOGbiSsSZNu7UDEwTEBVVo1E1yR4kWErcudXIQN hCtSRBN5jsNrMnTwJyNymbzAqUTlzm/Y8IBz155ZxZZLxx5xwYzpxtj1153BDsaLox0d pV2+9pgQ4iaYPGN8J4uxx7QhqONKOORnY8pLtJ+wnUrXqPNai+Mm2LjY1+yymKM4qVVm NntvhVGuB8NhfOGK/64VxfWhnVtXHdYEwGPzzv632C42arhodd9TbvYywbdxnwDAgzp1 jJRLZ9+VJnwzrtaUylthnxUSkTE24A6c95ngkFHocONICZg67z8WD/KmrbytbHAuEOeH 2hbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739955111; x=1740559911; h=mime-version:user-agent:references:in-reply-to:date:to:from:subject :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1LTtvVEAcWvwAzgNulpFuZH+/VUybcJLZgbrwVSKwtY=; b=FbxO7CDT8FgXsDNjRVTYZexQYdm5vYMQ9di7XA8n6onQ0Mbr+aVctq2XAhbggQY2br zORXD1FrjUIr4+/HIYr56MX/4OADg/FG9qyvmctGKNi13cjqFy891FhlgjtAEIspNAW5 1TLPiuj7sVgr9x8quG7To4WqRdxkEtmai/2f2X/NnivjN5vkmdq/kt7O48hNVQ1bkeXB ARHKLClSW3M8V5DEIkIBjhEx2F4SGW7fTtrx5LluKF5fzq0MHphhwhVwyJhioJz4UfnD Gj485gh4WzGJzTCd1jTu1iOhCPemkyX4ed4KNkhiWNRBJMiIU4jYcSjqhRQF5pkmWmXq bcdg== X-Forwarded-Encrypted: i=1; AJvYcCVcI7FdjdT+Wl1KLY+1Ztmqd1B6yfge4SYtp40Xw8/u0w1LlAR92sGxeFmKzbdjTDNJf6JetOZO5XOsKQ==@postgresql.org X-Gm-Message-State: AOJu0YzHzg8nqzxvb+4O5tfWgadgwD7KIs1vzFCo4SwhuP3wOxvX7t8p IcZ6Hn4z3B/mF/5Kbnqx5QFTs2GDcRZJg9roWL2yU4IaU4d/+x/L6ez2LL9YNYtpbkNcd+xiT/P kfrTf5R7n+jkTOZLkfR42uQpXJj5o6Dor7zHLLvXDLPZ9niDZvOTAmIINmzpkmpiyx60= X-Gm-Gg: ASbGnctCUcNSSX+uUuSOo44h0EX6Y3T+/Xr8OAcyFDaiOim3CQFuE0mJKXS8P0kHI7+ UyozcC9wYee3kS0sEfMWfzmDWVOe8yTAEdIHWC/PHfOSjh52v+XN4BAHcg01UrixoQNM3XNL4CE 8iUHs1uQyTnO9FgVzZptOlh4xDZ1Q71tOpbOgEXoxAcIoG9iDXXkZ/ODwkIbIl6le3wEUoSytvL OgTzLKBSCrhShOJczSrZb+dg4fP1CyCBRES6QgpNJi5fwc951l9HlGJIXmy2t+ZgFsp8lS3Ednp x2xFHXRSN3ZnFSEWGPniBDUclLebe+F1HLk= X-Google-Smtp-Source: AGHT+IFuGJANiaDyITvuszBcRwzWJJgUCOmxnmTUXI4rEHFUn5h24Q4LHQA5JpsgLrTlOrYE2OuuSw== X-Received: by 2002:a17:907:6ea1:b0:abb:2e65:96f7 with SMTP id a640c23a62f3a-abb70de296dmr1820311266b.43.1739955110805; Wed, 19 Feb 2025 00:51:50 -0800 (PST) Received: from localhost.localdomain ([2001:871:5e:517b:7a17:db82:bac2:ea1d]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-abb7200144fsm829761666b.184.2025.02.19.00.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2025 00:51:50 -0800 (PST) Message-ID: Subject: Re: Replica and transaction From: Laurenz Albe To: kaido vaikla , pgsql-admin Date: Wed, 19 Feb 2025 09:51:49 +0100 In-Reply-To: References: User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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.