Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8Vn6-00009K-4w for pgsql-general@arkaria.postgresql.org; Tue, 17 Apr 2018 18:57:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f8Vn4-00055N-Dm for pgsql-general@arkaria.postgresql.org; Tue, 17 Apr 2018 18:57:18 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8Vn4-000558-51 for pgsql-general@lists.postgresql.org; Tue, 17 Apr 2018 18:57:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8Vmv-0004Hz-Jb for pgsql-general@postgresql.org; Tue, 17 Apr 2018 18:57:16 +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 w3HIv3Qx002385; Tue, 17 Apr 2018 14:57:03 -0400 From: Tom Lane To: Alvaro Herrera cc: David Pacheco , pgsql-general@postgresql.org Subject: Re: Can PostgreSQL create new WAL files instead of reusing old ones? In-reply-to: <20180417182013.zi3wghrvyspiatkh@alvherre.pgsql> References: <20180417182013.zi3wghrvyspiatkh@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 17 Apr 2018 15:20:13 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2383.1523991423.1@sss.pgh.pa.us> Date: Tue, 17 Apr 2018 14:57:03 -0400 Message-ID: <2384.1523991423@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > David Pacheco wrote: >> tl;dr: We've found that under many conditions, PostgreSQL's re-use of old >> WAL >> files appears to significantly degrade query latency on ZFS. The reason is >> complicated and I have details below. Has it been considered to make this >> behavior tunable, to cause PostgreSQL to always create new WAL files >> instead of re-using old ones? > I don't think this has ever been proposed, because there was no use case > for it. Maybe you want to work on a patch for it? I think possibly the OP doesn't understand why it's designed that way. The point is not really to "recycle old WAL files", it's to avoid having disk space allocation occur during the critical section where we must PANIC on failure. Now, of course, that doesn't really work if the filesystem is COW underneath, because it's allocating fresh disk space anyway even though semantically we're overwriting existing data. But what I'd like to see is a fix that deals with that somehow, rather than continue to accept the possibility of ENOSPC occurring inside WAL writes on these file systems. I have no idea what such a fix would look like :-( regards, tom lane