Re: autovacuum not prioritising for-wraparound tables - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: autovacuum not prioritising for-wraparound tables
Date
Msg-id 20130125152915.GD5584@alvh.no-ip.org
Whole thread Raw
In response to Re: autovacuum not prioritising for-wraparound tables  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: autovacuum not prioritising for-wraparound tables
Re: autovacuum not prioritising for-wraparound tables
List pgsql-hackers
Tom Lane escribió:

> As posted, what we've got here is sorting on a boolean condition, with
> the behavior within each group totally up to the whims of qsort().  That
> seems especially dangerous since the priority order is mostly undefined.
>
> I was a bit surprised that Alvaro didn't propose sorting by the age of
> relfrozenxid, at least for the subset of tables that are considered
> wraparound hazards.  Not sure what a good criterion is for the rest.

Hah.  This patch began life with more complex prioritisation at first,
but before going much further I dumbed down the idea to avoid having to
discuss these issues, as it doesn't seem a particularly good timing.
And I do want to get something back-patchable.

So if we're to discuss this, here's what I had in mind:

1. for-wraparound tables always go first; oldest age(relfrozenxid) are
sorted earlier.  For tables of the same age, consider size as below.

2. for other tables, consider floor(log(size)).  This makes tables of
sizes in the same ballpark be considered together.

3. For tables of similar size, consider
(n_dead_tuples - threshold) / threshold.
"threshold" is what gets calculated as the number of tuples over which
a table is considered for vacuuming.  This number, then, is a relative
measure of how hard is vacuuming needed.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Hanging backends and possible index corruption
Next
From: Kohei KaiGai
Date:
Subject: Re: [sepgsql 1/3] add name qualified creation label