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

From Andres Freund
Subject Re: Add tracking of backend memory allocated to pg_stat_activity
Date
Msg-id 20221206175544.j5xwi5po3qpzg2jw@awork3.anarazel.de
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
Hi,

On 2022-12-06 08:47:55 -0500, Reid Thompson wrote:
> The intent was to capture and display all the memory allocated to the
> backends, for admins/users/max_total_backend_memory/others to utilize.

It's going to be far less accurate than that. For one, there's a lot of
operating system resources, like the page table, that are going to be
ignored. We're also not going to capture allocations done directly via
malloc(). There's also copy-on-write effects that we're ignoring.

If we just want to show an accurate picture of the current memory usage, we
need to go to operating system specific interfaces.


> Why should we ignore the allocations prior to backend_status.c?

It seems to add complexity without a real increase in accuracy to me. But I'm
not going to push harder on it than I already have.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Error-safe user functions
Next
From: Brar Piening
Date:
Subject: Re: doc: add missing "id" attributes to extension packaging page