Re: Add tracking of backend memory allocated to pg_stat_activity - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: Add tracking of backend memory allocated to pg_stat_activity
Date
Msg-id 20220901.134320.188875425242927802.horikyota.ntt@gmail.com
Whole thread Raw
In response to Add tracking of backend memory allocated to pg_stat_activity  (Reid Thompson <reid.thompson@crunchydata.com>)
Responses Re: Add tracking of backend memory allocated to pg_stat_activity
List pgsql-hackers
At Wed, 31 Aug 2022 12:03:06 -0400, Reid Thompson <reid.thompson@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



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [PATCH] Add native windows on arm64 support
Next
From: Justin Pryzby
Date:
Subject: Re: pg15b3: recovery fails with wal prefetch enabled