Re: Trigger more frequent autovacuums of heavy insert tables

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Melanie Plageman <melanieplageman@gmail.com>
Cc: Robert Treat <rob@xzilla.net>, Greg Sabino Mullane <htamfids@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>, Andres Freund <andres@anarazel.de>, Peter Geoghegan <pg@bowt.ie>, David Rowley <dgrowley@gmail.com>, Corey Huinker <corey.huinker@gmail.com>
Date: 2025-11-19T16:08:37Z
Lists: pgsql-hackers
On Tue, Nov 18, 2025 at 04:30:14PM -0500, Melanie Plageman wrote:
> I wish we could say "* number of unfrozen tuples". I know that's not
> true because we don't know how many tuples are on each page, but the
> formula feels a little overly detailed this way. Anyway, this is fine.
> I didn't apply and render the whole thing, but the wording looks good
> to me.

Committed, thanks for looking.

> It's actually interesting that we calculate the thresholds in tuples
> when vacuum operates per page. And the per tuple costs are not really
> as big of a deal as the per page costs.

Hm...  I wonder how much of a difference this makes and whether it's worth
changing.

-- 
nathan



Commits

  1. doc: Update formula for vacuum insert threshold.

  2. Redefine pg_class.reltuples to be -1 before the first VACUUM or ANALYZE.

  3. Measure the number of all-visible pages for use in index-only scan costing.