Re: Minimum tuple threshold to decide last pass of VACUUM

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Minimum tuple threshold to decide last pass of VACUUM
Date: 2015-08-03 08:13:13
Message-ID: CANP8+jKbC2HJ-44CAs4xY8KEZ2hbNQ_Or7Q01Go3_21A47v6Ng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2 August 2015 at 13:13, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:

> Hi all,
>
> Commit 4046e58c (dated of 2001) has introduced the following comment
> in vacuumlazy.c:
> + /* If any tuples need to be deleted, perform final vacuum cycle */
> + /* XXX put a threshold on min nuber of tuples here? */
> + if (vacrelstats->num_dead_tuples > 0)
> In short, we may want to have a reloption to decide if we do or not
> the last pass of VACUUM or not depending on a given number of
> remaining tuples. Is this still something we would like to have?
>

I don't think we want a new user parameter, but we should have an internal
limit with a heuristic, similar to how we decide whether to truncate.

I would suggest this internal logic...

* If its a VACUUM FREEZE then index_scan_threshold = 0, i.e. always scan if
needed, since the user is requesting maximum vacuum

* For emergency anti-wraparound VACUUMs we shouldn't scan indexes at all,
since they aren't critical path activities at that point

* For normal VACUUMs we should scan indexes only if (num_dead_tuples * 20)
> (blocks to be scanned in any one index), which allows some index bloat
but not much

--
Simon Riggs http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2015-08-03 08:35:19 Re: pg_rewind tap test unstable
Previous Message Andreas Seltenreich 2015-08-03 06:49:23 Re: [sqlsmith] Failed assertion in joinrels.c