Re: shared-memory based stats collector - v70 - Mailing list pgsql-hackers

From Drouvot, Bertrand
Subject Re: shared-memory based stats collector - v70
Date
Msg-id e67b920f-d89d-9f13-28e4-f753c9aef9ae@amazon.com
Whole thread Raw
In response to Re: shared-memory based stats collector - v70  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi,

On 8/9/22 6:47 PM, Andres Freund wrote:
> Hi,
>
> On 2022-08-09 12:00:46 -0400, Greg Stark wrote:
>> I was more aiming at a C function that extensions could use directly
>> rather than an SQL function -- though I suppose having the former it
>> would be simple enough to implement the latter using it. (though it
>> would have to be one for each stat type I guess)
> I think such a C extension could exist today, without patching core code? It'd
> be a bit ugly to include pgstat_internal.h, I guess, but other than that...

Yeah, agree that writing such an extension is doable today.

>> The main problem with my current code is that I'm accessing the shared
>> memory hash table directly. This means the I'm possibly introducing
>> locking contention on the shared memory hash table.
> I don't think that's a large enough issue to worry about unless you're
> polling at a very high rate, which'd be a bad idea in itself. If a backend
> can't get the lock for some stats change it'll defer flushing the stats a bit,
> so it'll not cause a lot of other problems.

+1

Regards,

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




pgsql-hackers by date:

Previous
From: "Drouvot, Bertrand"
Date:
Subject: Re: shared-memory based stats collector - v70
Next
From: Daniel Gustafsson
Date:
Subject: Re: createuser doesn't tell default settings for some options