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