Re: How about a option to disable autovacuum cancellation on lock conflict?

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How about a option to disable autovacuum cancellation on lock conflict?
Date: 2014-11-29 10:54:04
Message-ID: CABUevEy-ipGnaCgpi1xbGxhDeTK0G6V4_pyZzhZFYwEn3ovZeg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Nov 29, 2014 9:23 AM, "Andres Freund" <andres(at)2ndquadrant(dot)com> wrote:
>
> Hi,
>
> I've more than once seen that autovacuums on certain tables never
> succeed because regular exclusive (or similar) lockers cause it to give
> way/up before finishing. Usually if some part of the application uses
> explicit exclusive locks.
>
> In general I think it's quite imortant that autovacuum bheaves that
> way. But I think it might be worhtwile to offer an option to disable
> that behaviour. If some piece of application logic requires exclusive
> locks and that leads to complete starvation of autovacuum, there's
> really nothing that can be done but to manually schedule vacuums right
> now.
>
> I can see two possible solutions:
>
> 1) Add a reloption that allows to configure whether autovacuum gives way
> to locks acquired by user backends.
> 2) Add a second set of autovacuum_*_scale_factor variables that governs
> a threshhold after which autovacuum doesn't get cancelled anymore.
>
> Opinions?

I definitely think having such a tunable would be very useful, in edge
cases (so as you say the default should definitely be what it is today).

Another "trigger option" could be to say "you may terminate autovaccum this
many times before forcing one through", rather than triggers on tuple
count. But tuples is probably a better choice, as it gives more dynamics -
unless we want to do both.

/Magnus

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2014-11-29 16:57:14 Re: PATCH: decreasing memory needlessly consumed by array_agg
Previous Message David Rowley 2014-11-29 09:29:29 Removing INNER JOINs