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 1peA0M-00082d-OL for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Mar 2023 07:32:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1peA0L-0006fY-Hs for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Mar 2023 07:32:29 +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 1peA0K-0006fO-1d for pgsql-hackers@lists.postgresql.org; Mon, 20 Mar 2023 07:32:29 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1peA0F-0003rD-US for pgsql-hackers@lists.postgresql.org; Mon, 20 Mar 2023 07:32:27 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 290B33200312; Mon, 20 Mar 2023 03:32:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 20 Mar 2023 03:32:21 -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:sender :subject:subject:to:to; s=fm2; t=1679297540; x=1679383940; bh=N9 QEsbZHCKIIvi+r7Wq4/hMv5DqG3I4iIwnCMGpaY6Y=; b=frjENN9wdluOGrlJwr 5645sPB2/UlzF3nBr32sPgKa1Ihf2S8MRpDqVtamxlnvO+LbVZNm+5VSOYk+z/l1 Y+Y2kAOGQ3QLK2arEIOLerCUS/8kYpE60Ii/1/a9CKm3bBFJ4zzGVmQagFG8YSaq Qh2Dfsj8qS6mhO1Jl8dwtLI6xmRm3bSb0G7IG9Ma2BCUa2vVlFJSSHrxOdZx+oMi /DdA8qKj/aBCGvKVXHwBMc0xB8BTUdS9VNv2yFGnahf8pwgzu43dRbuBeDs5ovzK SEIXw93l3cWxHdjoiAyV3gz+KsuXz0SajpHVfiSfDHMlP6h4MtmSBmr8YgpqjaM6 ScGg== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1679297540; x=1679383940; bh=N9QEsbZHCKIIv i+r7Wq4/hMv5DqG3I4iIwnCMGpaY6Y=; b=gved9hwSUx3dBXGJ+9JxQOZRbiSsW LOcTVWz7PmIPlYZJffN/LcuOCUZxZ/Zfa78YdQPOhciOW2MxDYZTp2j+UxcNOVFV Lb9uHKDUPtRg7cHcM/jUXfXwhdhAXBEVH9F/Rt3OUyy0zjUF2foUjqZu7qDVdCAw n4p8WVfkx8gfS7awV2s2bAahbw9esRyc5o4ETenO7rRmbp2VcW4Pm+BVpNieHJxs K6bjHXqu7l+xXiUZL0YRjzfhsjQez6VT3LN4AOm1iumGKf0MhgInc8NlRYI+2DtI h5A0G6bSJtvriVFMLVa/WnaJz4emWmGgZqfp/Tml6DhlmQqIUqkx5vyjg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdefjedgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreer tddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlse hprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteel geeggeffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdig hiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 20 Mar 2023 03:32:18 -0400 (EDT) Date: Mon, 20 Mar 2023 16:32:14 +0900 From: Michael Paquier To: Andres Freund Cc: Alvaro Herrera , "Drouvot, Bertrand" , PostgreSQL Hackers Subject: Re: Remove nonmeaningful prefixes in PgStat_* fields Message-ID: References: <9142f62a-a422-145c-bde0-b5bc498a4ada@gmail.com> <20230112171252.xucefmthy5l4l2ec@alvherre.pgsql> <20230112180733.agmvpugp6ggorade@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xOEvr2eDcBvHaKZy" Content-Disposition: inline In-Reply-To: <20230112180733.agmvpugp6ggorade@awork3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --xOEvr2eDcBvHaKZy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jan 12, 2023 at 10:07:33AM -0800, Andres Freund wrote: > The problem with that is that the prefixes are used completely inconsistently > - and have been for a long time. And not just between the different type of > stats. Compare e.g. PgStat_TableCounts with PgStat_TableXactStatus and > PgStat_StatTabEntry. Whereas PgStat_FunctionCounts and PgStat_StatFuncEntry > both use it. Right now there's no way to remember where to add the t_ prefix, > and where not. > > Imo the reason to rename here isn't to abolish prefixes, it's to be halfway > consistent within closeby code. And the code overwhelmingly doesn't use the > prefixes. Reading through the patch, two things are done, basically: - Remove the prefix "t_" from the fields related to table stats. - Remove the prefix "f_" from the fields related to function stats. And FWIW, with my recent lookups at the pgstat code, I'd like to think that removing the prefixes is actually an improvement in consistency. It will help in refactoring this code to use more macros, reducing its size, as well. So, the code paths where the structures are updated are pretty short so you know to what they refer to. And that's even more OK because now the objects are split into their own files, so you know what you are dealing with even if the individual variable names are more common. That's for pgstat_relation.c and pgstat_function.c, first. The second part of the changes involves pgstatfuncs.c, where all the objects are grouped in a single file. We don't lose any information here, either, as the code updated deals with a "tabentry" or "funcentry". There is a small part in pgstat.h where a few macros have their fields renamed, where we manipulate a "rel", so that looks rather clear to me what we are dealing with, IMO. /* Total time previously charged to function, as of function start */ - instr_time save_f_total_time; + instr_time save_total_time; I have something to say about this one, though.. I find this change a bit confusing. It may be better kept as it is, or I think that we'd better rename also "save_total" and "start" to reflect in a better way what they do, because removing "f_" reduces the meaning of the field with the two others in the same structure. -- Michael --xOEvr2eDcBvHaKZy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmQYC/4ACgkQnvQgOdby QH2cDA/9HjpuoIyrsbhMxQp9QlZO8Bb7rwoy49ptA2xxyJOKynyqoOPS9UwjY9qh /3kIBjNV+d2sjYn2iV7CJF6DJg8cQwrV3CC1y9ZYS7NdnD2B2rDSzkiUqQsSNSk6 bTa3+6l8bLdUWSjTP/jm2GYu8K+6GnYITxEnc/j+SVgIuPwYip9vfrRPVnvGiQaZ eNzkXzLuAyowAbQMw1vrNaWGTCywt9yA0hNnXt0RbQ4oSNdUrzRY5/76Vp/v/Nh0 VzIyXH77lEOaMXPTJtl3AQ18PCMYPVMmjEhgA/wLCMFgzEFn9Uti8rxmHXBQHTM/ UOFkWhR9UN+mmh//sQzfQRy/mfScXwZf6fiuQ2BuI8JD2gVKuNXqmDyzl07akf84 Z0B4MB1SNDgaKHkM5RBEU/HjiWikBsHXN098xv8STv8AroRPzTTbOcS+H1+OsVwd JvxnrcHMbEjg3ulPQbp4jnFUOv4c9rsbJhkTJnDxjjBYVuTOcM/wfLTajBgn1zb6 Kexic8Mgi578HvymoviEFOGXmw6roKrZGD3s0L+72hJO4CHTTyH3Egk3M8YIinQD /1PEIbV32Tnif9x4SOsxgznICIhOr6k0tOlNPoRtwD54VDfAFeq4RIBipgCN+heU rj2N3xYYBsfF8SbhkfJsRhWTD3ZPocGqatMJMJeyUwdnZBUAQKw= =ZRGX -----END PGP SIGNATURE----- --xOEvr2eDcBvHaKZy--