public inbox for [email protected]  
help / color / mirror / Atom feed
From: Drouvot, Bertrand <[email protected]>
To: Greg Stark <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Melanie Plageman <[email protected]>
Cc: Kyotaro Horiguchi <[email protected]>
Cc: Justin Pryzby <[email protected]>
Cc: Thomas Munro <[email protected]>
Cc: David G. Johnston <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: shared-memory based stats collector - v70
Date: Thu, 18 Aug 2022 08:27:10 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAM-w4HNLtcKxrG0WepCKjt5tizbvZRcrqABX=jNNZoi_18E5rw@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CAM-w4HN=4ss5dS2DH6Cof=zocJXeGOjRNKxEGgUZdJPMndyNzA@mail.gmail.com>
	<CAAKRu_Z18jYbarKA4GZMOO00KtUqKtBqgQ8SgB=wSvSqKq3iiA@mail.gmail.com>
	<[email protected]>
	<CAM-w4HOxaO6iJ94bGt1A65PRgX_b4gGSmb4mdzakZ1QhvGW=jA@mail.gmail.com>
	<[email protected]>
	<CAM-w4HMhHAxjpXNVMZ5WhULHpd3+LuP27zaSKSFnzZeRwHZTjg@mail.gmail.com>
	<[email protected]>
	<CAM-w4HNqCR7X9q5_wbJi4wLfTT1gLvy5VRS+ZGo6z8-DbXkHpw@mail.gmail.com>
	<[email protected]>
	<CAM-w4HP_YL8uPrNiv2DPKmq1KD3QLEX7CBLc5DCJ9j7mf7eerw@mail.gmail.com>
	<[email protected]>
	<CAM-w4HPGq_rpZAW4p71+d90oykyi9y7PgiQ1c9_ROs+WROCjuQ@mail.gmail.com>
	<[email protected]>
	<CAM-w4HNLtcKxrG0WepCKjt5tizbvZRcrqABX=jNNZoi_18E5rw@mail.gmail.com>

Hi,

On 8/17/22 9:46 PM, Greg Stark wrote:
> On Tue, 16 Aug 2022 at 08:49, Drouvot, Bertrand <[email protected]> wrote:
>>
>> +               if (p->key.kind != PGSTAT_KIND_RELATION)
>> +                       continue;
> Hm. So presumably this needs to be extended. Either to let the caller
> decide which types of stats to return or to somehow return all the
> stats intermixed. In my monitoring code I did the latter because I
> didn't think going through the hash table repeatedly would be very
> efficient. But it's definitely a pretty awkward API since I need a
> switch statement that explicitly lists each case and casts the result.

What I had in mind is to provide an API to retrieve stats for those that 
would need to connect to each database individually otherwise.

That's why I focused on PGSTAT_KIND_RELATION that has 
PgStat_KindInfo.accessed_across_databases set to false.

I think that another candidate could also be PGSTAT_KIND_FUNCTION.

I think that's the 2 cases where a monitoring tool connected to a single 
database is currently missing stats related to databases it is not 
connected to.

So what about 2 functions? one to get the stats for the relations and 
one to get the stats for the functions? (And maybe a view on top of each 
of them?)

Regards,

-- 
Bertrand Drouvot
Amazon Web Services: https://aws.amazon.com






view thread (82+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: shared-memory based stats collector - v70
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox