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: Andres Freund <andres@anarazel.de>, Masahiko Sawada <masahiko.sawada@2ndquadrant.com>, 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>, pgsql-hackers@lists.postgresql.org, Alvaro Herrera <alvherre@2ndquadrant.com>, Michael Banck <mbanck@gmx.net>
Date: 2020-03-25T15:06:56Z
Lists: pgsql-hackers
On Mon, Mar 23, 2020 at 02:27:29PM +0100, Laurenz Albe wrote:
> Here is version 10 of the patch, which uses a scale factor of 0.2.

Thanks

> Any table that has received more inserts since it was
> last vacuumed (and that is not vacuumed for another
> reason) will be autovacuumed.

Since this vacuum doesn't trigger any special behavior (freeze), you can remove
the parenthesized part: "(and that is not vacuumed for another reason)".

Maybe in the docs you can write this with thousands separators: 10,000,000

It looks like the GUC uses scale factor max=1e10, but the relopt is still
max=100, which means it's less possible to disable for a single rel.

> +++ b/src/backend/access/common/reloptions.c
> @@ -398,6 +407,15 @@ static relopt_real realRelOpts[] =
>  		},
>  		-1, 0.0, 100.0
>  	},
> +	{
> +		{
> +			"autovacuum_vacuum_insert_scale_factor",
> +			"Number of tuple inserts prior to vacuum as a fraction of reltuples",
> +			RELOPT_KIND_HEAP | RELOPT_KIND_TOAST,
> +			ShareUpdateExclusiveLock
> +		},
> +		-1, 0.0, 100.0
> +	},
>  	{
>  		{
>  			"autovacuum_analyze_scale_factor",

> +++ b/src/backend/utils/misc/guc.c
> @@ -3549,6 +3558,17 @@ static struct config_real ConfigureNamesReal[] =
>  		0.2, 0.0, 100.0,
>  		NULL, NULL, NULL
>  	},
> +
> +	{
> +		{"autovacuum_vacuum_insert_scale_factor", PGC_SIGHUP, AUTOVACUUM,
> +			gettext_noop("Number of tuple inserts prior to vacuum as a fraction of reltuples."),
> +			NULL
> +		},
> +		&autovacuum_vac_ins_scale,
> +		0.2, 0.0, 1e10,
> +		NULL, NULL, NULL
> +	},
> +
>  	{
>  		{"autovacuum_analyze_scale_factor", PGC_SIGHUP, AUTOVACUUM,
>  			gettext_noop("Number of tuple inserts, updates, or deletes prior to analyze as a fraction of reltuples."),



Commits

  1. Further improve stability fix for partition_aggregate test.

  2. Improve stability fix for partition_aggregate test.

  3. Attempt to stabilize partitionwise_aggregate test

  4. Fix race condition in statext_store().

  5. Attempt to fix unstable regression tests, take 2

  6. Attempt to fix unstable regression tests

  7. Trigger autovacuum based on number of INSERTs

  8. Fix upper limit for vacuum_cleanup_index_scale_factor