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: Mark Dilger <mark.dilger@enterprisedb.com>, Euler Taveira <euler@eulerto.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-04-09T20:19:12Z
Lists: pgsql-hackers
On Wed, Apr 9, 2025, 12:39 Sami Imseih <samimseih@gmail.com> wrote:

>
> They will differ because n_tup_ins keeps increasing, while
> n_ins_since_vacuum is
> reset after a vacuum. The issue I see is that n_ins_since_vacuum should
> only
> reflect the number of newly inserted rows that are eligible for
> freezing, as described
> in pgstat_report_vacuum [0]
>

Vacuuming them into oblivion is a form of freezing.  It also removes the
aging xid from the table.

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