Re: admin control over cancelling autovacuum when blocked by a lock

From: John Lumby <johnlumby(at)hotmail(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>
Subject: Re: admin control over cancelling autovacuum when blocked by a lock
Date: 2019-04-30 01:14:52
Message-ID: DM6PR06MB556216D6085FE0B9C267E82CA33A0@DM6PR06MB5562.namprd06.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


On 04/29/2019 07:15 PM, Simon Riggs wrote:
> On Mon, 29 Apr 2019 at 22:02, John Lumby <johnlumby(at)hotmail(dot)com
> <mailto:johnlumby(at)hotmail(dot)com>> wrote:
>
> If a regular backend worker becomes blocked waiting for a lock
> held by an autovacuum worker,
> then , depending on some decision made by deadlock detector,
> the autovacuum worker may be signalled to terminate
>
> [ ... ]
>
>
>
> Is there any configuration parameter which controls this?
>
> [ ... ]
>
>
> Why would you want this?
Because it greatly reduces rate of growth of certain indexes in some
workloads
(based on test in which I modified the code to change the cancel to a
plain WARNING)
>
> If the autovacuum is cancelled, it will re-execute again in the near
> future, once your interrupting SQL has released locks.
In the particular workload I'm investigating, which involves a great
deal of repetitive
insert and delete activity on one table with several indexes,
even with the most aggressive autovacuum settings I can find,
it ends up being cancelled nearly 99% of the time, and (question)
I *think* when an autovacuum worker is cancelled, all or most of the work
it did on its last table is undone -- true? I am basing that on
observing
growth of dead rows, not on the code, so not sure.
But changing the cancel to a WARNING certainly prevents
growth of dead rows without slowing the workload down unacceptably.

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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2019-04-30 01:37:44 Re: admin control over cancelling autovacuum when blocked by a lock
Previous Message Simon Riggs 2019-04-29 23:15:08 Re: admin control over cancelling autovacuum when blocked by a lock