Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tpyZx-00F48H-F2 for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Mar 2025 23:55:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tpyZv-009eQH-NT for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Mar 2025 23:55:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tpyZv-009eQ9-Dc for pgsql-hackers@lists.postgresql.org; Wed, 05 Mar 2025 23:55:07 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tpyZr-001C3U-1d for pgsql-hackers@postgresql.org; Wed, 05 Mar 2025 23:55:07 +0000 Received: from [192.168.11.5] (p1695135-ipoe.ipoe.ocn.ne.jp [118.0.92.134]) by oss.nttdata.com (Postfix) with ESMTPSA id A001E61A7D; Thu, 6 Mar 2025 08:54:59 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <28773a66-fb88-41cf-a7ec-4216e6c91c94@oss.nttdata.com> Date: Thu, 6 Mar 2025 08:54:59 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Disabling vacuum truncate for autovacuum Content-Language: en-US To: Nathan Bossart , Gurjeet Singh Cc: Robert Haas , Laurenz Albe , Postgres Hackers , Will Storey References: From: Fujii Masao In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025/03/01 3:21, Nathan Bossart wrote: > On Thu, Feb 27, 2025 at 08:29:16PM -0800, Gurjeet Singh wrote: >> On Mon, Jan 27, 2025 at 1:55 AM Laurenz Albe wrote: >>> I hope it is possible to override the global setting with the "vacuum_truncate" >>> option on an individual table. >> >> Current patch behaviour is that if the autovacuum_vacuum_truncate is false, then >> autovacuum will _not_ truncate any relations. If the parameter's value is true >> (the default), then the relation's reloption will be honored. >> >> A table-owner, or the database-owner, may enable truncation of a table, as they >> may be trying to be nice and return the unused disk space back to the >> OS/filesystem. But if the sysadmin/DBA (who is ultimately responsible for the >> health of the entire db instance, as well as of any replicas of the db >> instance), >> wants to disable truncation across all databases to ensure that the replication >> does not get stuck, then IMHO Postgres should empower the sysadmin to make >> that decision, and override the relation-level setting enabled by the table- >> owner or the database-owner. > > IIUC reloptions with corresponding GUCs typically override the GUC setting, > although autovacuum_enabled is arguably an exception. If setting the GUC > to false overrides the relation-specific settings, it also becomes more > difficult to enable truncation for just a couple of tables, although that > might not be a popular use-case. Furthermore, even if we do want the GUC > to override the reloption, it won't override VACUUM (TRUNCATE). +1 to having the reloption (if specified) override the GUC setting. That is, I think that autovacuum_vacuum_truncate as defining the default behavior for VACUUM truncation, and that the GUC should only apply when neither the TRUNCATE option in VACUUM nor the reloption is set. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION