Re: Enhancing Memory Context Statistics Reporting

Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>

From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
To: Rahila Syed <rahilasyed90@gmail.com>
Cc: Alexander Korotkov <aekorotkov@gmail.com>, Daniel Gustafsson <daniel@yesql.se>, Tomas Vondra <tomas@vondra.me>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-03-17T08:36:50Z
Lists: pgsql-hackers
On Mon, Mar 17, 2025 at 1:23 PM Rahila Syed <rahilasyed90@gmail.com> wrote:
>
>>
>> v17-0002-Function-to-report-memory-context-statistics.patch
>>
>> +   if (procNumber == MyProcNumber)
>> +   {
>> +       ereport(WARNING,
>> +               errmsg("cannot return statistics for local backend"),
>> +               errhint("Use pg_backend_memory_contexts view instead."));
>> +       PG_RETURN_NULL();
>> +   }
>>
>> Is it worth it to keep this restriction?  Can we fetch info about
>> local memory context for the sake of generality?
>>
>
> I think that could be done, but using pg_backend_memory_context would
> be more efficient in this case.
>

I have raised a similar concern before. Having two separate functions
one for local backend and other for remote is going to be confusing.
We should have one function doing both and renamed appropriately.


-- 
Best Wishes,
Ashutosh Bapat



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Cross-check lists of built-in LWLock tranches.

  2. Convert strncpy to strlcpy

  3. Typo and doc fixups for memory context reporting

  4. Add missing string terminator

  5. Rename argument in pg_get_process_memory_contexts().

  6. Add function to get memory context stats for processes