Re: autovacuum not prioritising for-wraparound tables

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Browne <cbbrowne(at)gmail(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: autovacuum not prioritising for-wraparound tables
Date: 2013-01-25 15:29:15
Message-ID: 20130125152915.GD5584@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kohei KaiGai 2013-01-25 15:29:41 Re: [sepgsql 1/3] add name qualified creation label
Previous Message Andres Freund 2013-01-25 15:28:16 Re: Hanging backends and possible index corruption