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

From Ted Yu
Subject Re: Add tracking of backend memory allocated to pg_stat_activity
Date
Msg-id CALte62zc20PuSc=iCg+2-+-3Bh6k4xPXVUZZCuF5mpfh5SjSMg@mail.gmail.com
Whole thread Raw
In response to Re: Add tracking of backend memory allocated to pg_stat_activity  (Reid Thompson <reid.thompson@crunchydata.com>)
List pgsql-hackers


On Sat, Nov 26, 2022 at 9:32 PM Reid Thompson <reid.thompson@crunchydata.com> wrote:
On Sat, 2022-11-26 at 22:10 -0500, Reid Thompson wrote:
> Code rebased to current master.
> Updated to incorporate additional recommendations from the the list
>    - add units to variables in view
>    - remove 'backend_' prefix from variables/functions
>    - update documentation
>    - add functional test for allocated_bytes
>    - refactor allocation reporting to reduce number of functions and
>      branches/reduce performance hit
>    - zero allocated bytes after fork to avoid double counting
> postmaster allocations
>
>
>
>

attempt to remedy cfbot windows build issues


Hi,

+               if (request_size > *mapped_size)
+               {
+                       pgstat_report_allocated_bytes(*mapped_size, DECREASE);
+                       pgstat_report_allocated_bytes(request_size, INCREASE);

pgstat_report_allocated_bytes is called twice for this case. Can the two calls be combined into one (with request_size - *mapped_size, INCREASE) ?

Cheers

pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: Documentation for building with meson
Next
From: Justin Pryzby
Date:
Subject: Re: Add tracking of backend memory allocated to pg_stat_activity