Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJlGj-0008Ah-1M for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Aug 2022 00:32:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oJlGh-0006gk-7u for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Aug 2022 00:32:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJlGg-0006XJ-Th for pgsql-hackers@lists.postgresql.org; Fri, 05 Aug 2022 00:32:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJlGe-0001AQ-PX for pgsql-hackers@lists.postgresql.org; Fri, 05 Aug 2022 00:32:45 +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 2750WSk33699206; Thu, 4 Aug 2022 20:32:28 -0400 From: Tom Lane To: Andres Freund cc: Robert Haas , Dilip Kumar , Justin Pryzby , Ashutosh Sharma , Maciek Sakrejda , Bruce Momjian , Alvaro Herrera , Andrew Dunstan , Heikki Linnakangas , PostgreSQL Hackers , Thomas Munro Subject: Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints In-reply-to: References: <2767668.1659476794@sss.pgh.pa.us> <20220802220416.GC13682@telsasoft.com> <20220802222334.umf5wsa2r63koppn@awork3.anarazel.de> <3663919.1659650570@sss.pgh.pa.us> <3679800.1659654066@sss.pgh.pa.us> <20220804231204.kcr6sfpshzvt5qi3@awork3.anarazel.de> <3684408.1659655216@sss.pgh.pa.us> Comments: In-reply-to Andres Freund message dated "Thu, 04 Aug 2022 17:06:04 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3699204.1659659548.1@sss.pgh.pa.us> Date: Thu, 04 Aug 2022 20:32:28 -0400 Message-ID: <3699205.1659659548@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > Is there a good reason to rely on P_NEW at all? Both from an efficiency > and robustness POV it seems like it'd be better to use smgrextend to > bulk extend just after smgrcreate() and then fill s_b u using RBM_ZERO > (or whatever it is called). That bulk smgrextend would later be a good > point to use fallocate so the FS can immediately size the file > correctly, without a lot of pointless writes of zeroes. Hmm ... makes sense. We'd be using smgrextend to write just the last page of the file, relying on its API spec "Note that we assume writing a block beyond current EOF causes intervening file space to become filled with zeroes". I don't know that we're using that assumption aggressively today, but as long as it doesn't confuse the kernel it'd probably be fine. regards, tom lane