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 1kczVD-0003WR-QJ for pgsql-docs@arkaria.postgresql.org; Wed, 11 Nov 2020 23:26:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kczVC-0006Gd-QJ for pgsql-docs@arkaria.postgresql.org; Wed, 11 Nov 2020 23:26:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kczTT-0004if-D7 for pgsql-docs@lists.postgresql.org; Wed, 11 Nov 2020 23:24:23 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kczTQ-0001TV-Ov for pgsql-docs@lists.postgresql.org; Wed, 11 Nov 2020 23:24:22 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kczTN-0007Bw-UR; Wed, 11 Nov 2020 18:24:17 -0500 Date: Wed, 11 Nov 2020 18:24:17 -0500 From: Bruce Momjian To: Chris Wilson Cc: Thomas Munro , Pg Docs Subject: Re: What does "[backends] should seldom or never need to wait for a write to occur" mean? Message-ID: <20201111232417.GH25840@momjian.us> References: <160399562040.7809.7335281028960123489@wrigleys.postgresql.org> <20201110013632.GA8789@momjian.us> <20201110160801.GA25651@momjian.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="k+w/mQv8wyuph6w0" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Nov 11, 2020 at 11:29:09AM +0000, Chris Wilson wrote: > I still believe that my original proposed change, to "This reduces the chances > that a backend needing an empty buffer must [itself] write a dirty one back to > disk before evicting it" (with one extra word added), resolves the ambiguity > and also more clearly and directly focuses it on what the bgwriter does and > why, making it better documentation. It might be incorrect if my understanding > is incorrect - is it? You make some very good points. Here is an updated patch. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee --k+w/mQv8wyuph6w0 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="bgwriter.diff" diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index f043433e31..294017c86e 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2146,9 +2146,12 @@ include_dir 'conf.d' There is a separate server process called the background writer, whose function is to issue writes of dirty (new or modified) shared - buffers. It writes shared buffers so server processes handling - user queries seldom or never need to wait for a write to occur. - However, the background writer does cause a net overall + buffers. When the percentage of dirty shared buffers is high, the + background writer writes some of them to the file system and marks + them as clean. This reduces the likelihood that server processes + handling user queries will be unable to find clean buffers and have + to write dirty buffers to the file system themselves. However, + the background writer does cause a net overall increase in I/O load, because while a repeatedly-dirtied page might otherwise be written only once per checkpoint interval, the background writer might write it several times as it is dirtied --k+w/mQv8wyuph6w0--