Re: n_ins_since_vacuum stats for aborted transactions

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Sami Imseih <samimseih@gmail.com>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, Mark Dilger <mark.dilger@enterprisedb.com>, Euler Taveira <euler@eulerto.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-04-18T04:13:02Z
Lists: pgsql-hackers
On Sat, 12 Apr 2025 at 07:33, Sami Imseih <samimseih@gmail.com> wrote:
> What do you think of the attached?

I looked at the v3 patch and I'm having trouble getting excited about it.

I'd say this part is misleading:

@@ -3956,7 +3961,8 @@ description | Waiting for a newly initialized
WAL file to reach durable storage
        <structfield>n_dead_tup</structfield> <type>bigint</type>
       </para>
       <para>
-       Estimated number of dead rows
+       Estimated number of dead rows (updated by committed transactions, or by
+       <command>VACUUM</command> and <command>VACUUM FULL</command>)
       </para></entry>

An aborted insert will contribute to that counter, but that's not mentioned.

Would it be ok just to adjust n_mod_since_analyze's "Estimated number
of rows modified since this table was last analyzed" and inject "by
committed transactions" after "modified", then call it a day?

David



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