Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRQPm-00FGkl-Oj for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jul 2024 06:02:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sRQPk-002QIx-LI for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jul 2024 06:02:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRQPj-002QIp-Pp for pgsql-hackers@lists.postgresql.org; Wed, 10 Jul 2024 06:02:52 +0000 Received: from fout3-smtp.messagingengine.com ([103.168.172.146]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRQPg-001LCI-TA for pgsql-hackers@lists.postgresql.org; Wed, 10 Jul 2024 06:02:51 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfout.nyi.internal (Postfix) with ESMTP id BC4261380ADB; Wed, 10 Jul 2024 02:02:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 10 Jul 2024 02:02:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1720591366; x=1720677766; bh=T3gMPBJiXG jaKpXdLkGe19HDj58tonS7MUQP1RJpUGY=; b=pocDgFLzhLWgYOEoqoMM5/VYVI I7rzdrj4Y5ShInDlWhC3eHEhY1F64cLpYWDohODJAxdJHP9DUKugIyF9eW4Vp9H4 Fmb6KlNL5CBI4i3Oqavr4fFEtp+u/CO6YaLrQlIvN8jGBS6E9MOS38Si4N9L6NND TtQaRcaHWVKHzvGmQ1OyWEKswI/GpdUxgp1OOUr1DH6Ysxax/StwlbWCw6GRs2j0 3D63uO13kzR9E4q+YDc2Yl9lfYlR7oqaaz8BC5Unu3HcluGC1i8p53/awq8CztWe x4YDH4RMQ5frzZsA9rkO7GZ1m3l+k3kXyJlvrZC4t/2lfHye8EROz59XwhDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1720591366; x=1720677766; bh=T3gMPBJiXGjaKpXdLkGe19HDj58t onS7MUQP1RJpUGY=; b=KtYlHK5FT4ODfJfuIUd1UfIw/Gso4fv8ey/mVCU32zg/ hzXBA4WhsqQe9/tXA0/FjZTAi0zZd/MLImc4+PVDzIxmaXYBaVRXd8NznYcx5MAJ 99koOnjOgaPBz3zVU4HAOHH8td5VYxDv6qpU6oaWqAsc+VjDqjCJr3pGJUkSIsJ4 rvJ9Q3jvLJ5oyiAwrR75DfUPUgigELH3eepY8r1rAXD4VXAWSuJ6FguUV/wAHJ5O Kgx+PQ8gah/7KD8s1bvMqLpxtng23zADnqNiz+RmEA7jtqh2AU1TGTt5NFXyFxMb Fmh9hjTCJPi9TTIVdjykdLE4b5p01uWKES0lOuytxA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrfedtgddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpeffhf fvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghq uhhivghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvg hrnhepteelieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdej necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitg hhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Jul 2024 02:02:44 -0400 (EDT) Date: Wed, 10 Jul 2024 15:02:34 +0900 From: Michael Paquier To: Bertrand Drouvot Cc: pgsql-hackers@lists.postgresql.org Subject: Re: relfilenode statistics Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tmxuB7aoL5XaddBi" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --tmxuB7aoL5XaddBi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, May 25, 2024 at 07:52:02AM +0000, Bertrand Drouvot wrote: > But I think that it is in a state that can be used to discuss the approach it > is implementing (so that we can agree or not on it) before moving > forward. I have read through the patch to get an idea of how things are done, and I am troubled by the approach taken (mentioned down by you), but that's invasive compared to how pgstats wants to be transparent with its stats kinds. + Oid objoid; /* object ID, either table or function or tablespace. */ + RelFileNumber relfile; /* relfilenumber for RelFileLocator. */ } PgStat_HashKey; This adds a relfilenode component to the central hash key used for the dshash of pgstats, which is something most stats types don't care about. That looks like the incorrect thing to do to me, particularly seeing a couple of lines down that a stats kind is assigned so the HashKey uniqueness is ensured by the KindInfo: + [PGSTAT_KIND_RELFILENODE] = { + .name = "relfilenode", FWIW, I have on my stack of patches something to switch the objoid to 8 bytes, actually, which is something that would be required for pg_stat_statements as query IDs are wider than that and affect all databases, FWIW. Relfilenodes are 4 bytes, okay still Robert has proposed a couple of years ago a patch set to bump that to 56 bits, change reverted in a448e49bcbe4. The objoid is also not something specific to OIDs, see replication slots with their idx for example. What you would be looking instead is to use the relfilenode as an objoid and keep track of the OID of the original relation in each PgStat_StatRelFileNodeEntry so as it is possible to know where a past relfilenode was used? That makes looking back at the past relation's elfilenodes stats more complicated as it would be necessary to keep a list of the past relfilenodes for a relation, as well. Perhaps with some kind of cache that maintains a mapping between the relation and its relfilenode history? -- Michael --tmxuB7aoL5XaddBi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmaOI/oACgkQnvQgOdby QH3pdBAAnJskDbuUzrXtQHhgIXIzKDpIUcqfmWizS+fWeiRcjk2t4hepNYofdkAq XRfsBp92xdBMQMpGaNSEGBeLVdPqJo/wGq4VEPALD0ekEVe7wBQvE/oHS9CmMX44 H2QKPOksYqABccmR7cSWuVD3/nOGgKQbo/L/qDKwP4P2sV33FS26x02QqzJCdBh+ wBgzL4xeuKfSxRW43R9sRj8xzx/7gNp5KUc+VtZ4j0Fn9vsIOF9HSbqA/BcV/kT5 kayyTRrgzRgHktF0aLBOjfPin2kS2rscz0K9o+DEFKsm4dlJ+5/Zmi17puUvcwwh PDCrFhto7xgItVMqEqmtJOtE0Iwn/kOKyRyNqXEyLiY1kM8L5pHhHGFcRcjLLM4T stHlRv+d//YVJE9Hqqn3F9vBJij3WQ3ZeryR36CSsGtogOddLR5vPjrxADC6xrBu 61WaPjAjpfMF9YiUW+KHzj2iCnEm4sicp477ACIOQ97Kees8MMIYmo43JDLgAsrW g3p95lZBV0L115Zds1gA4mb/s9zTjPZwBhwPLxUxrkTA10HvBJq5Uolxt/fco3dL Q26Yyr0VNAwfwKK6Mk2CXJ1yBWegVdREwIFQb7gY8H7IFmrApH78EQ2eHIx0taqO S4/yZMSazjCE7d9xtLw7WDKyJDRw+cQ4+9qWXlJS3DFYa0p0H8s= =9jER -----END PGP SIGNATURE----- --tmxuB7aoL5XaddBi--