Re: xact_rollback spikes when logical walsender exits

Nikolay Samokhvalov <nik@postgres.ai>

From: Nikolay Samokhvalov <nik@postgres.ai>
To: vignesh C <vignesh21@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>, Rafael Thofehrn Castro <rafaelthca@gmail.com>
Date: 2026-05-13T00:06:40Z
Lists: pgsql-hackers

Attachments

On Mon, Apr 20, 2026 at 11:38 PM vignesh C <vignesh21@gmail.com> wrote:

> Another approach could be to introduce a wrapper around
> AbortCurrentTransaction(), for example
> AbortCurrentTransactionWithoutUpdateStats(), that skips the
> AtEOXact_PgStat() call in this case.
> Thoughts?



Thanks -- v2 attached, adopting your wrapper.

One scope choice worth flagging: the wrapper suppresses only
AtEOXact_PgStat_Database() (the DB-level xact_commit/xact_rollback
counter), not all of AtEOXact_PgStat().  Per-relation and subxact stat
handling still run, so nothing accumulated during the cleanup is lost.
Renamed to AbortCurrentTransactionWithoutXactStats() to match.

Nik