At Wed, 31 Aug 2022 12:03:06 -0400, Reid Thompson 
<reid.thomp...@crunchydata.com> wrote in 
> Attached is a patch to 
> Add tracking of backend memory allocated to pg_stat_activity

> @@ -916,6 +930,7 @@ AllocSetAlloc(MemoryContext context, Size size)
>                       return NULL;
>  
>               context->mem_allocated += blksize;
> +             pgstat_report_backend_mem_allocated_increase(blksize);

I'm not sure this is acceptable. The function adds a branch even when
the feature is turned off, which I think may cause a certain extent of
performance degradation. A past threads [1], [2] and [3] might be
informative.

[1] 
https://www.postgresql.org/message-id/1434311039.4369.39.camel%40jeff-desktop
[2] 
https://www.postgresql.org/message-id/72a656e0f71d0860161e0b3f67e4d771%40oss.nttdata.com
[3] 
https://www.postgresql.org/message-id/0271f440ac77f2a4180e0e56ebd944d1%40oss.nttdata.com

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center


Reply via email to