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 1pfu9C-0005Kj-G2 for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Mar 2023 03:00:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pfu9B-0002IC-D1 for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Mar 2023 03:00:49 +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 1pfu9B-0002Hu-3k for pgsql-hackers@lists.postgresql.org; Sat, 25 Mar 2023 03:00:49 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfu98-0002e0-Op for pgsql-hackers@lists.postgresql.org; Sat, 25 Mar 2023 03:00:48 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 27CC55C0127; Fri, 24 Mar 2023 23:00:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 24 Mar 2023 23:00:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; 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=1679713246; x=1679799646; bh=ra OruiVcHlskz/5VNbKi5T53HeqqNdN5+q1X7qaygS4=; b=SYwg1qpmOXmc9bqwKW 9cchiJZgROSnanas5mqYpIQvkVcoUIUHVEya2N0eqxXxmE2z/oFIsWKP0J/c6MzX AExZ2QTY+ApsP42iX9FylAT3Z5AwaeflH8HKH3/FSCWsDBl8CM8LwqAmG203a2hv F7ODVkQz3+Q+gC11c4f8sAko+OWsgAL0Fa9N5qRXUkr7os/kP9yH7HoogJzYo9c5 K76frOs9CpS+ObSvEWYRB2NkwDOpJpFdCN+/ijwf7kURnzGah/bcatA9AnxI1Dqz f0Db7bSfs6GT74d8MvEe5v4aFBE0t6NIBCxV+ucoTiXSBTeHVvJGg/MUKDxvncoe c+BA== 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=1679713246; x=1679799646; bh=raOruiVcHlskz /5VNbKi5T53HeqqNdN5+q1X7qaygS4=; b=hZKcseq20qp0zJpk2kexmD4MNXI9S XDA7IPt5QeP0B1RfdHx04RWDHL6gjL0eOvVWDlgjcBD3dI/VgSAo7Cm01ocaUTBh P6SHHVkqS8CP+I1ydNic86IpKa2nhw74Qsl2jrvJGMUybo1R2igvc+UDqsRBtCOG ypN+XRLj2B619J4WCQpGnsDY0EqmPPsXiclyQBC2Xt9QuKgkLOXMnyiUx9jPPPXQ 3sjMR+E49OfXep7F+y7pg87cHPZcnHPvT3kLBuDyFG8YiQDEKt9Fr0OJsNfUEseL 2J5hnPx9jUzGzatNDDe1f3OWmhsoW8yDol41T5XZPRDEavxUb7X6A2IbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegjedgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 24 Mar 2023 23:00:45 -0400 (EDT) Date: Fri, 24 Mar 2023 20:00:44 -0700 From: Andres Freund To: Michael Paquier Cc: "Drouvot, Bertrand" , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org Subject: Re: Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry Message-ID: <20230325030044.nhfas3nommsmwl6q@awork3.anarazel.de> References: <9262b2a9-6785-1f83-bf7f-7fcf90c2c113@gmail.com> <20230215.095644.822493184688844040.horikyota.ntt@gmail.com> <130095b4-7c6d-b6f1-69d4-94f66231f81d@gmail.com> <20230216212121.uvav7xgdh2ysqjy5@awork3.anarazel.de> <621ed53c-4d9a-8f77-ab8c-20235f2d95a1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-03-25 11:56:22 +0900, Michael Paquier wrote: > On Thu, Mar 16, 2023 at 02:13:45PM +0100, Drouvot, Bertrand wrote: > > On 3/16/23 12:46 PM, Michael Paquier wrote: > >>> I don't think we should pay any particular attention to those 2 ones > >>> as anyway nothing prevent the 7 others to be called outside of the > >>> pg_stat_xact_all_tables view. > >> > >> I am not quite sure, TBH. Did you look at the difference with a long > >> chain of subtrans, like savepoints? The ODBC driver "loves" producing > >> a lot of savepoints, for example. > > > > No, I did not measure the impact. > > I have been thinking again about this particular point, and I would be > fine with an additional boolean flag to compute the subtrans data in > the global counter when only necessary. This would not make the > macros for the stat functions that much more complicated, while being > sure that we don't do unnecessary computations when we know that we > don't need them.. I don't understand what we're optimizing for here. These functions are very very very far from being a hot path. The xact functions are barely ever used. Compared to the cost of query evaluation the cost of iterating throught he subxacts is neglegible. Greetings, Andres Freund