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 1mQJkb-0003yU-CO for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Sep 2021 01:30:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mQJkY-0005Cn-NI for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Sep 2021 01:30:10 +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 1mQJkY-0005CT-A7 for pgsql-hackers@lists.postgresql.org; Wed, 15 Sep 2021 01:30:10 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQJkV-0003oL-26 for pgsql-hackers@postgresql.org; Wed, 15 Sep 2021 01:30:09 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 06C415C01E5; Tue, 14 Sep 2021 21:30:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 14 Sep 2021 21:30:06 -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=xO6xEdVF66b7mlp6WUd5DLCUBqTn06faDw1YdaYU2J8=; b=KAI0U1HD gwKfYcBMSUpkg02d0XjorNZK7RANvS3uB+ig3hd1WDAvs3eOXMM2kmDRnNP2JpfQ LJuP1MMedjaT1wvJhqsLoCzWtOA0QdXGsoelyzG26EtZkszSY9oFKooXZnKKyk4W EC0Q39tZXcxxPh7Gb+wUxA4LbAa28Pqsu+/X2zKLRaQ6x4O+3B9NWayc3VG3oOlY b8tHB+IbIghosfr6HqJzrAkvyihS8Og0pWVN6RiFyY7MzZY3wGTzoQC1hRuXdqos 9GrC1CmuRorhcOgPBRCQ5soHEs3vVZifeY1VAXtU04PmfY1iCfGHmNR0GCA6jneR ooVXwx26z9e7jQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudehtddggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeduieektdelvdevffefuefhvedvleffjeelieffgeeuheeg vdfgtdejledtueehkeenucffohhmrghinhepphgrthgthhdrihhtpdgvnhhtvghrphhrih hsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Sep 2021 21:30:05 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 226782A0868; Tue, 14 Sep 2021 22:30:02 -0300 (-03) Date: Tue, 14 Sep 2021 22:30:02 -0300 From: Alvaro Herrera To: Melanie Plageman Cc: Andres Freund , Kyotaro Horiguchi , Magnus Hagander , Pg Hackers , Lukas Fittl , Thomas Munro Subject: Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?) Message-ID: <202109150130.psq5flaujqxf@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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 Hello Melanie On 2021-Sep-13, Melanie Plageman wrote: > I also think it makes sense to rename the pg_stat_buffer_actions view to > pg_stat_buffers and to name the columns using both the buffer action > type and buffer type -- e.g. shared, strategy, local. This leaves open > the possibility of counting buffer actions done on other non-shared > buffers -- like those done while building indexes or those using local > buffers. The third patch in the set does this (I wanted to see if it > made sense before fixing it up into the first patch in the set). What do you think of the idea of having the "shared/strategy/local" attribute be a column? So you'd have up to three rows per buffer action type. Users wishing to see an aggregate can just aggregate them, just like they'd do with pg_buffercache. I think that leads to an easy decision with regards to this point: > I attached a patch with the outline of this idea > (buffer_type_enum_addition.patch). It doesn't work because > pg_stat_get_buffer_actions() uses the BufferActionType as an index into > the values array returned. If I wanted to use a combination of the two > enums as an indexing mechanism (BufferActionType and BufferType), we > would end up with a tuple having every combination of the two > enums--some of which aren't valid. It might not make sense to implement > this. I do think it is useful to think of these stats as a combination > of a buffer action and a type of buffer. Does that seem sensible? (It's weird to have enum values that are there just to indicate what's the maximum value. I think that sort of thing is better done by having a "#define LAST_THING" that takes the last valid value from the enum. That would free you from having to handle the last value in switch blocks, for example. LAST_OCLASS in dependency.h is a precedent on this.) -- Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/ "That sort of implies that there are Emacs keystrokes which aren't obscure. I've been using it daily for 2 years now and have yet to discover any key sequence which makes any sense." (Paul Thomas)