Re: maintenance_work_mem used by Vacuum

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Teodor Sigaev <teodor(at)sigaev(dot)ru>
Subject: Re: maintenance_work_mem used by Vacuum
Date: 2019-10-09 08:29:57
Message-ID: CAFiTN-uKAzQP7a5-kmuGvPyfHiop8nXEQJiOniqQ9MF-Gw7GQA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 9, 2019 at 10:22 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> On Tue, Oct 8, 2019 at 2:45 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Tue, Oct 8, 2019 at 1:48 AM Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> > >
> > > On Mon, Oct 7, 2019 at 12:28 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> > > > I would say that sucks, because it makes it harder to set
> > > > maintenance_work_mem correctly. Not sure how hard it would be to fix,
> > > > though.
> > >
> > > ginInsertCleanup() may now be the worst piece of code in the entire
> > > tree, so no surprised that it gets this wrong too.
> > >
> > > 2016's commit e2c79e14d99 ripped out the following comment about the
> > > use of maintenance_work_mem by ginInsertCleanup():
> > >
> > > @@ -821,13 +847,10 @@ ginInsertCleanup(GinState *ginstate,
> > > * Is it time to flush memory to disk? Flush if we are at the end of
> > > * the pending list, or if we have a full row and memory is getting
> > > * full.
> > > - *
> > > - * XXX using up maintenance_work_mem here is probably unreasonably
> > > - * much, since vacuum might already be using that much.
> > > */
> > >
> > > ISTM that the use of maintenance_work_mem wasn't given that much
> > > thought originally.
> > >
> >
> > One idea to something better could be to check, if there is a GIN
> > index on a table, then use 1/4 (25% or whatever) of
> > maintenance_work_mem for GIN indexes and 3/4 (75%) of
> > maintenance_work_mem for collection dead tuples.
> >
>
> I felt that it would not be easy for users to tune
> maintenance_work_mem which controls more than one things. If this is
> an index AM(GIN) specific issue we might rather want to control the
> memory limit of pending list cleanup by a separate GUC parameter like
> gin_pending_list_limit, say gin_pending_list_work_mem. And we can
> either set the (the memory for GIN pending list cleanup / # of GIN
> indexes) to the parallel workers.
>
IMHO if we do that then we will loose the meaning of having
maintenance_work_mem right? Then user can not control that how much
memory the autovacuum worker will use.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-10-09 09:10:29 Re: maintenance_work_mem used by Vacuum
Previous Message Christoph Berg 2019-10-09 07:33:54 Re: pgsql: Remove pqsignal() from libpq's official exports list.