Re: Add tracking of backend memory allocated to pg_stat_activity

From: Andres Freund <andres(at)anarazel(dot)de>
To: Reid Thompson <reid(dot)thompson(at)crunchydata(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>
Subject: Re: Add tracking of backend memory allocated to pg_stat_activity
Date: 2022-12-06 17:55:44
Message-ID: 20221206175544.j5xwi5po3qpzg2jw@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Brar Piening 2022-12-06 17:59:59 Re: doc: add missing "id" attributes to extension packaging page
Previous Message Robert Haas 2022-12-06 17:10:09 Re: Error-safe user functions