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 1oM1Q7-0005i4-Aq for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Aug 2022 06:11:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oM1Q6-0006T2-5f for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Aug 2022 06:11:50 +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 1oM1Q5-0006QN-Fr for pgsql-hackers@lists.postgresql.org; Thu, 11 Aug 2022 06:11:49 +0000 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oM1Q2-0000AO-LQ for pgsql-hackers@lists.postgresql.org; Thu, 11 Aug 2022 06:11:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1660198307; x=1691734307; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=PKOeQorndit/PbPAb3SZuzfEWFtehQJk7zafw7bZJWg=; b=Vrd/gfzt+1PRZYTHCMiqCu1iDx6UtS/lGntawbEzdu1FVPF4bMONnBC3 BkidlGjYtiM4WAbDOjEQbYOYKSnEs0KSpv+SE1ImdYaMbpx0xlAjMaNCA m2Cj41jVSXO8EYhjqtMLZFHMaqqIZZf0IxRVI+E7RNJV3+0jG7W6Dswb0 8=; Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-pdx-2c-a264e6fe.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-6001.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2022 06:11:34 +0000 Received: from EX13D03EUC003.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2c-a264e6fe.us-west-2.amazon.com (Postfix) with ESMTPS id 7BF2844B1C; Thu, 11 Aug 2022 06:11:32 +0000 (UTC) Received: from [192.168.6.176] (10.43.161.199) by EX13D03EUC003.ant.amazon.com (10.43.164.192) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Thu, 11 Aug 2022 06:11:28 +0000 Message-ID: <0befffb3-8323-f2cd-915f-0ab64396f500@amazon.com> Date: Thu, 11 Aug 2022 08:11:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.1.1 Subject: Re: shared-memory based stats collector - v70 Content-Language: en-US To: Greg Stark CC: Andres Freund , Tom Lane , Melanie Plageman , Kyotaro Horiguchi , Justin Pryzby , Thomas Munro , "David G. Johnston" , PostgreSQL Hackers References: <20220317073652.kz3uuh6le6vbfod4@alap3.anarazel.de> <20220325.142256.1649716600998659084.horikyota.ntt@gmail.com> <20220325.172418.1055357550509939415.horikyota.ntt@gmail.com> <20220402082102.ojdd2e6cobsmljvh@alap3.anarazel.de> <20220404041516.cctrvpadhuriawlq@alap3.anarazel.de> <20220405030506.lfdhbu5zf4tzdpux@alap3.anarazel.de> <20220406030008.2qxipjxo776dwnqs@alap3.anarazel.de> <1736122.1658333315@sss.pgh.pa.us> <83D73EC0-E3ED-4C98-A528-5E122278D553@anarazel.de> <5db2b670-f3df-57ea-bdc6-962a582ff2e4@amazon.com> From: "Drouvot, Bertrand" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.43.161.199] X-ClientProxiedBy: EX13d09UWC002.ant.amazon.com (10.43.162.102) To EX13D03EUC003.ant.amazon.com (10.43.164.192) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 8/10/22 11:25 PM, Greg Stark wrote: > On Wed, 10 Aug 2022 at 04:05, Drouvot, Bertrand wrote: >> Hi, >> >> On 8/9/22 6:00 PM, Greg Stark wrote: >>> On Tue, 9 Aug 2022 at 06:19, Drouvot, Bertrand wrote: >>>> What do you think about adding a function in core PG to provide such >>>> functionality? (means being able to retrieve all the stats (+ eventually >>>> add some filtering) without the need to connect to each database). >>> I'm working on it myself too. I'll post a patch for discussion in a bit. >> Great! Thank you! > So I was adding the code to pgstat.c because I had thought there were > some data types I needed and/or static functions I needed. However you > and Andres encouraged me to check again now. And indeed I was able, > after fixing a couple things, to make the code work entirely > externally. Nice! Though I still think to have an SQL API in core could be useful to. As Andres was not -1 about that idea (as it should be low cost to add and maintain) as long as somebody cares enough to write something: then I'll give it a try and submit a patch for it. > > This is definitely not polished and there's a couple obvious things > missing. But at the risk of embarrassment I've attached my WIP. Please > be gentle :) I'll post the github link in a bit when I've fixed up > some meta info. Thanks! I will have a look at it on github (once you share the link). Regards, -- Bertrand Drouvot Amazon Web Services: https://aws.amazon.com