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 1lpHk3-0001zV-Nl for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Jun 2021 21:52:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lpHk1-0003Ny-45 for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Jun 2021 21:52:33 +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 1lpHk0-0003Mo-Ak for pgsql-hackers@lists.postgresql.org; Fri, 04 Jun 2021 21:52:32 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lpHjt-0002Sa-Vp for pgsql-hackers@postgresql.org; Fri, 04 Jun 2021 21:52:30 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 93BB416DE; Fri, 4 Jun 2021 17:52:22 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 04 Jun 2021 17:52:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=GUQI7VBJ+3Nudk21Nyx5YmF17kyyF9zTIc3xn4gfRrA=; b=BJv5n2XK pLpvMs60C9mMlPvE3fsCqRYjcj/L1Qtp/BPabv01rtVwyoh4l81fnUeL9dCwHPI8 mDvm42RUVy1+qQfIfPzITg/fz8en4xqvU+QjLQAlI/InU689DOmNubB+D+tDhV1S JmhqsycjKyUq4K7H9ChJ/U7hqjDeSBG2FBHdQTXsTmMgGnKm1xtXpiyavAMrZWmj EKcZ/L3J24YfiVfUxGWiB3zvctB3/oQtnbLfkCjDfN4qrYIHVokkzlVU3+c6J2bm Y+bKO8SL4VXMwWGS9JdY7oY7qTd8UomiXytOjB1AGDMq9JA8iu3na2L9YqbBw104 OKcrgHEqNBy5Zw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtvddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttddunecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeeggeevveffveejffdutefhvddtgeeghffhgfeuhfefjeei gfevhfefleevtdduteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Jun 2021 17:52:20 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 981FB2A0D0C; Fri, 4 Jun 2021 17:52:17 -0400 (-04) Date: Fri, 4 Jun 2021 17:52:17 -0400 From: Alvaro Herrera To: Melanie Plageman Cc: Kyotaro Horiguchi , Andres Freund , Magnus Hagander , Pg Hackers , lukas@fittl.com, Thomas Munro Subject: Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?) Message-ID: <202106042152.ny3a4fqoefx7@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Apr-12, Melanie Plageman wrote: > As for the way I have recorded strategy writes -- it is quite inelegant, > but, I wanted to make sure that I only counted a strategy write as one > in which the backend wrote out the dirty buffer from its strategy ring > but did not check if there was any clean buffer in shared buffers more > generally (so, it is *potentially* an avoidable write). I'm not sure if > this distinction is useful to anyone. I haven't done enough with > BufferAccessStrategies to know what I'd want to know about them when > developing or using Postgres. However, if I don't need to be so careful, > it will make the code much simpler (though, I'm sure I can improve the > code regardless). I was bitten last year by REFRESH MATERIALIZED VIEW counting its writes via buffers_backend, and I was very surprised/confused about it. So it seems definitely worthwhile to count writes via strategy separately. For a DBA tuning the server configuration it is very useful. The main thing is to *not* let these writes end up regular buffers_backend (or whatever you call these now). I didn't read your patch, but the way you have described it seems okay to me. -- Álvaro Herrera 39°49'30"S 73°17'W