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 1sVPI1-009ePj-St for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Jul 2024 05:39:21 +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 1sVPHz-006Icd-5A for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Jul 2024 05:39:19 +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 1sVPHy-006IcV-Rp for pgsql-hackers@lists.postgresql.org; Sun, 21 Jul 2024 05:39:19 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sVPHw-000f71-S8 for pgsql-hackers@lists.postgresql.org; Sun, 21 Jul 2024 05:39:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 46L5dDHl535628; Sun, 21 Jul 2024 01:39:13 -0400 From: Tom Lane To: Fujii Masao cc: Ronan Dunklau , Stephen Frost , pgsql-hackers@lists.postgresql.org Subject: Re: Provide a pg_truncate_freespacemap function In-reply-to: <8acb1f83-2945-42cf-8795-780c94bbed36@oss.nttdata.com> References: <5446938.Sb9uPGUboI@aivenlaptop> <4331161.ejJDZkT8p0@aivenlaptop> <8acb1f83-2945-42cf-8795-780c94bbed36@oss.nttdata.com> Comments: In-reply-to Fujii Masao message dated "Sun, 21 Jul 2024 13:51:56 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <535626.1721540353.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sun, 21 Jul 2024 01:39:13 -0400 Message-ID: <535627.1721540353@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Fujii Masao writes: >> Le mercredi 6 mars 2024, 20:28:44 CET Stephen Frost a écrit : >>> I agree that this would generally be a useful thing to have. Personally, I want to push back on whether this has any legitimate use-case. Even if the FSM is corrupt, it should self-heal over time, and I'm not seeing the argument why truncating it would speed convergence towards correct values. Worse, in the interim where you don't have any FSM, you will suffer table bloat because insertions will be appended at the end of the table. So this looks like a foot-gun, and the patch's lack of user-visible documentation surely does nothing to make it safer. (The analogy to pg_truncate_visibility_map seems forced. If you are in a situation with a trashed visibility map, you are probably getting wrong query answers, and truncating the map will make that better. But a trashed FSM doesn't result in incorrect output, and zeroing it will make things worse not better.) regards, tom lane