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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Lumby <johnlumby(at)hotmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Subject: Re: admin control over cancelling autovacuum when blocked by a lock
Date: 2019-04-30 01:44:22
Message-ID: 19835.1556588662@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

John Lumby <johnlumby(at)hotmail(dot)com> writes:
> On 04/29/2019 07:15 PM, Simon Riggs wrote:
>> 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)

[ raised eyebrow... ] Shouldn't do so, I think. What exactly are you
doing that's causing the cancel?

> I *think* when an autovacuum worker is cancelled, all or most of the work
> it did on its last table is undone -- true?

If what's canceled is the final step of truncating off empty end pages
in the table, you shouldn't lose anything except the actual truncation.
And that's normally the only part that gets canceled, because it's the
only part that takes a strong lock. If you're losing index cleanup
work, it suggests that you're repeatedly executing DDL that requires
exclusive lock on the table. Maybe you could avoid doing that?

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

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