Re: Berserk Autovacuum (let's save next Mandrill)
Justin Pryzby <pryzby@telsasoft.com>
From: Justin Pryzby <pryzby@telsasoft.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: David Rowley <dgrowleyml@gmail.com>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, Amit Kapila <amit.kapila16@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, Darafei Komяpa Praliaskouski <me@komzpa.net>, Andres Freund <andres@anarazel.de>, Alvaro Herrera <alvherre@2ndquadrant.com>, Michael Banck <mbanck@gmx.net>, pgsql-hackers@lists.postgresql.org
Date: 2020-03-05T17:27:49Z
Lists: pgsql-hackers
On Thu, Mar 05, 2020 at 03:27:31PM +0100, Laurenz Albe wrote: > On Thu, 2020-03-05 at 19:40 +1300, David Rowley wrote: > > 1. I'd go for 2 new GUCs and reloptions. > > autovacuum_vacuum_insert_scale_factor and these should work exactly > > I disagree about the scale_factor (and have not added it to the > updated version of the patch). If we have a scale_factor, then the > time between successive autovacuum runs would increase as the table > gets bigger, which defeats the purpose of reducing the impact of each > autovacuum run. I would vote to include scale factor. You're right that a nonzero scale factor would cause vacuum to run with geometrically decreasing frequency. The same thing currently happens with autoanalyze as a table grows in size. I found that our monthly-partitioned tables were being analyzed too infrequently towards the end of the month. (At the beginning of the month, 10% is 2.4 hours worth of timeseries data, but at the end of the month 10% is 3 days, which was an issue when querying the previous day may have rowcount estimates near zero.) If someone wanted to avoid that, they'd set scale_factor=0. I think this patch should parallel what's already in place, and we can add documention for the behavior if need be. Possibly scale_factor should default to zero, which I think might make sense since insert-only tables seem to be the main target of this patch. > +++ b/doc/src/sgml/maintenance.sgml > + <para> > + Tables that have received more than > + <xref linkend="guc-autovacuum-vacuum-insert-threshold"/> > + inserts since they were last vacuumed and are not eligible for vacuuming > + based on the above criteria will be vacuumed to reduce the impact of a future > + anti-wraparound vacuum run. > + Such a vacuum will aggressively freeze tuples, and it will not clean up dead > + index tuples. "BUT will not clean .." > +++ b/src/backend/postmaster/autovacuum.c > + /* > + * If the number of inserted tuples exceeds the limit I would say "exceeds the threshold" Thanks for working on this; we would use this feature on our insert-only tables. -- Justin
Commits
-
Further improve stability fix for partition_aggregate test.
- 18d85e9b8a2b 13.0 landed
-
Improve stability fix for partition_aggregate test.
- 7cb0a423f914 13.0 landed
-
Attempt to stabilize partitionwise_aggregate test
- cefb82d49e21 13.0 landed
-
Fix race condition in statext_store().
- fe3036527a1f 13.0 landed
- 6c426cd43790 12.3 landed
-
Attempt to fix unstable regression tests, take 2
- 24566b359d09 13.0 landed
-
Attempt to fix unstable regression tests
- 2dc16efedc76 13.0 landed
-
Trigger autovacuum based on number of INSERTs
- b07642dbcd8d 13.0 landed
-
Fix upper limit for vacuum_cleanup_index_scale_factor
- 4d54543efa5e 11.0 cited