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-03-03T18:11:37Z
Lists: pgsql-hackers
On Mon, Mar 03, 2025 at 12:18:37PM -0500, Melanie Plageman wrote: > I noticed the docs wording is kind of different than that in > postgresql.conf.sample. The docs wording mentions that the scale > factor gets added to the threshold and postgresql.conf.sample does not > (in master as well). I just wanted to make sure my updates to > postgresql.conf.sample sound accurate. > -#autovacuum_vacuum_insert_scale_factor = 0.2 # fraction of inserts over table > - # size before insert vacuum > +#autovacuum_vacuum_insert_scale_factor = 0.2 # fraction of unfrozen pages > + # inserted to before insert vacuum Hm. So for autovacuum_vacuum_scale_factor and autovacuum_analyze_scale_factor, we have "fraction of table size before vacuum" "fraction of table size before analyze" And currently, for autovacuum_vacuum_insert_scale_factor, we have "fraction of inserts over table size before insert vacuum" I think the key change here is that we are replacing "table size" with "unfrozen pages," which would give us "fraction of inserts over unfrozen pages before insert vacuum" However, I find that unclear, if for no other reason than I'm not sure what "over" means in this context. A reader might think that refers to the fraction (i.e., inserts / unfrozen pages), or they might think it means "on" or "above." IMHO your proposed wording is much clearer. The only part that feels a bit awkward to me is "to before". My mind wants the "to" to be followed with a verb, so I stumbled the first time I read it and had to read it again. Perhaps we could just say "fraction of unfrozen pages before insert vacuum" That more closely matches the other scale factor parameters. It's admittedly quite terse, but so are the vast majority of other descriptions in the sample file. I don't think those are intended to serve as substitutes for the "real" documentation. I would make the same argument for leaving out the base threshold. While it is important information, these extremely concise descriptions don't really have enough room for the nitty-gritty details. -- nathan
Commits
-
doc: Update formula for vacuum insert threshold.
- cbdce71b9984 19 (unreleased) landed
- c99436f43322 18.2 landed
-
Redefine pg_class.reltuples to be -1 before the first VACUUM or ANALYZE.
- 3d351d916b20 14.0 cited
-
Measure the number of all-visible pages for use in index-only scan costing.
- e6858e665731 9.2.0 cited