Re: [HACKERS] GUC for cleanup indexes threshold.

Alexander Korotkov <a.korotkov@postgrespro.ru>

From: Alexander Korotkov <a.korotkov@postgrespro.ru>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Simon Riggs <simon@2ndquadrant.com>, Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>, Yura Sokolov <y.sokolov@postgrespro.ru>, Peter Geoghegan <pg@bowt.ie>, Andres Freund <andres@anarazel.de>, Robert Haas <robertmhaas@gmail.com>, David Steele <david@pgmasters.net>, Amit Kapila <amit.kapila16@gmail.com>, "Ideriha, Takeshi" <ideriha.takeshi@jp.fujitsu.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Kuntal Ghosh <kuntalghosh.2007@gmail.com>, pgsql-hackers-owner@postgresql.org
Date: 2018-03-14T12:25:03Z
Lists: pgsql-hackers
On Wed, Mar 14, 2018 at 7:40 AM, Masahiko Sawada <sawada.mshk@gmail.com>
wrote:

> On Sat, Mar 10, 2018 at 3:40 AM, Alexander Korotkov
> <a.korotkov@postgrespro.ru> wrote:
> > On Fri, Mar 9, 2018 at 3:12 PM, Masahiko Sawada <sawada.mshk@gmail.com>
> > wrote:
> >>
> >> On Fri, Mar 9, 2018 at 8:43 AM, Alexander Korotkov
> >> <a.korotkov@postgrespro.ru> wrote:
> >> > 2) These parameters are reset during btbulkdelete() and set during
> >> > btvacuumcleanup().
> >>
> >> Can't we set these parameters even during btbulkdelete()? By keeping
> >> them up to date, we will able to avoid an unnecessary cleanup vacuums
> >> even after index bulk-delete.
> >
> >
> > We certainly can update cleanup-related parameters during btbulkdelete().
> > However, in this case we would update B-tree meta-page during each
> > VACUUM cycle.  That may cause some overhead for non append-only
> > workloads.  I don't think this overhead would be sensible, because in
> > non append-only scenarios VACUUM typically writes much more of
> information.
> > But I would like this oriented to append-only workload patch to be
> > as harmless as possible for other workloads.
>
> What overhead are you referring here? I guess the overhead is only the
> calculating the oldest btpo.xact. And I think it would be harmless.
>

I meant overhead of setting last_cleanup_num_heap_tuples after every
btbulkdelete with wal-logging of meta-page.  I bet it also would be
harmless, but I think that needs some testing.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Commits

  1. Fix upper limit for vacuum_cleanup_index_scale_factor

  2. Increase upper limit for vacuum_cleanup_index_scale_factor

  3. Fixes for vacuum_cleanup_index_scale_factor GUC option

  4. Skip full index scan during cleanup of B-tree indexes when possible