Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLHot-0004jL-Kw for pgsql-admin@arkaria.postgresql.org; Tue, 30 Apr 2019 01:44:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hLHos-0000l0-66 for pgsql-admin@arkaria.postgresql.org; Tue, 30 Apr 2019 01:44:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLHor-0000kt-TS for pgsql-admin@lists.postgresql.org; Tue, 30 Apr 2019 01:44:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLHoo-0007u8-7j for pgsql-admin@postgresql.org; Tue, 30 Apr 2019 01:44:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x3U1iMED019836; Mon, 29 Apr 2019 21:44:22 -0400 From: Tom Lane To: John Lumby cc: pgsql-admin , Simon Riggs Subject: Re: admin control over cancelling autovacuum when blocked by a lock In-reply-to: References: Comments: In-reply-to John Lumby message dated "Tue, 30 Apr 2019 01:14:52 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19834.1556588662.1@sss.pgh.pa.us> Date: Mon, 29 Apr 2019 21:44:22 -0400 Message-ID: <19835.1556588662@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk John Lumby 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