pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Masahiko Sawada <msawada@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Skip logical decoding of already-aborted transactions.
Date: Thu, 13 Feb 2025 00:32:37 +0000
Message-ID: <E1tiN9h-006ovP-4a@gemulon.postgresql.org> (raw)

Skip logical decoding of already-aborted transactions.

Previously, transaction aborts were detected concurrently only during
system catalog scans while replaying a transaction in streaming mode.

This commit adds an additional CLOG lookup to check the transaction
status, allowing the logical decoding to skip changes also when it
doesn't touch system catalogs, if the transaction is already
aborted. This optimization enhances logical decoding performance,
especially for large transactions that have already been rolled back,
as it avoids unnecessary disk or network I/O.

To avoid potential slowdowns caused by frequent CLOG lookups for small
transactions (most of which commit), the CLOG lookup is performed only
for large transactions before eviction. The performance benchmark
results showed there is not noticeable performance regression due to
CLOG lookups.

Reviewed-by: Amit Kapila, Peter Smith, Vignesh C, Ajin Cherian
Reviewed-by: Dilip Kumar, Andres Freund
Discussion: https://postgr.es/m/CAD21AoDht9Pz_DFv_R2LqBTBbO4eGrpa9Vojmt5z5sEx3XwD7A@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/072ee847ad4c3fb52b0c24f7dddbe0798bd70c24

Modified Files
--------------
contrib/test_decoding/expected/stats.out        |  42 +++++-
contrib/test_decoding/expected/stream.out       |   6 +
contrib/test_decoding/sql/stats.sql             |  20 ++-
contrib/test_decoding/sql/stream.sql            |   6 +
src/backend/replication/logical/reorderbuffer.c | 186 +++++++++++++++++++-----
src/include/replication/reorderbuffer.h         |  32 +++-
6 files changed, 246 insertions(+), 46 deletions(-)



Message-ID: <E1tiN9h-006ovP-4a@gemulon.postgresql.org>
Permalink:  ../E1tiN9h-006ovP-4a@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tiN9h-006ovP-4a@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: msawada@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Skip logical decoding of already-aborted transactions.
  In-Reply-To: <E1tiN9h-006ovP-4a@gemulon.postgresql.org>

* 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