Re: n_ins_since_vacuum stats for aborted transactions

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Sami Imseih <samimseih@gmail.com>
Cc: Euler Taveira <euler@eulerto.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-04-09T19:31:03Z
Lists: pgsql-hackers
On Wed, Apr 9, 2025, 11:57 Sami Imseih <samimseih@gmail.com> wrote:

> > Forget original purpose, is there presently a bug or not?
>
> Yes, there is a bug. Accounting rows inserted as part of an aborted
> transaction in
> n_ins_since_vacuum is not correct, since the same rows are being
> accounted for with n_dead_tup.
>

So why is it important we not account for the aborted insert in both
n_ins_since_vacuum and n_dead_tup?

When would you ever add them together so that an actual double-counting
would reflect in some total.

You aren't upset that n_live_tup and this both include the non-aborted
inserts.

David J.

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add code comment explaining ins_since_vacuum and aborted inserts

  2. Trigger autovacuum based on number of INSERTs