Re: Creating a function for exposing memory usage of backend process

Fujii Masao <masao.fujii@oss.nttdata.com>

From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: torikoshia <torikoshia@oss.nttdata.com>
Cc: pgsql-hackers@postgresql.org
Date: 2020-06-29T06:13:13Z
Lists: pgsql-hackers

On 2020/06/29 12:01, torikoshia wrote:
> On 2020-06-20 03:11, Robert Haas wrote:
>> On Wed, Jun 17, 2020 at 11:56 PM Fujii Masao
>> <masao.fujii@oss.nttdata.com> wrote:
>>> > As a first step, to deal with (3) I'd like to add
>>> > pg_stat_get_backend_memory_context() which target is limited to the
>>> > local backend process.
>>>
>>> +1
>>
>> +1 from me, too.
> 
> Attached a patch that adds a function exposing memory usage of local
> backend.

Thanks for the patch!
Could you add this patch to Commitfest 2020-07?

> 
> It's almost same as pg_cheat_funcs's pg_stat_get_memory_context().

This patch provides only the function, but isn't it convenient to
provide the view like pg_shmem_allocations?


> I've also added MemoryContexts identifier because it seems useful to
> distinguish the same kind of memory contexts.

Sounds good. But isn't it better to document each column?
Otherwise, users cannot undersntad what "ident" column indicates.

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION



Commits

  1. Add regression test for pg_backend_memory_contexts.

  2. Move codes for pg_backend_memory_contexts from mmgr/mcxt.c to adt/mcxtfuncs.c.

  3. Prevent non-superusers from reading pg_backend_memory_contexts, by default.

  4. Add pg_backend_memory_contexts system view.

  5. Fix yet another issue with step generation in partition pruning.