Hi Torikoshia,

Thank you for the review.

>
>
>    =# select path FROM pg_get_process_memory_contexts('20271', false);
>    path
>    -------
>     {0}
>     {0,1}
>     {0,2}
>     ..
>
> =# select path from pg_backend_memory_contexts;
>     path
>    -------
>     {1}
>     {1,2}
>     {1,3}
>     ..asdf asdf
>
> Would it be better to begin with 1 to make them consistent?
>
> Makes sense, fixed in the attached patch.

pg_log_backend_memory_contexts() does not allow non-superusers to
> execute by default since it can peek at other session information.
> pg_get_process_memory_contexts() does not have this restriction, but
> wouldn't it be necessary?
>
> Yes. I added the restriction to only allow super users and
users with pg_read_all_stats privileges to query the memory context
statistics of another process.


> When the target pid is the local backend, the HINT suggests using
> pg_get_backend_memory_contexts(), but this function is not described in
> the manual.
> How about suggesting pg_backend_memory_contexts view instead?
>
>    =# select pg_get_process_memory_contexts('27041', false);
>    WARNING:  cannot return statistics for local backend
>    HINT:  Use pg_get_backend_memory_contexts instead
>
>
> There are no explanations about 'num_agg_contexts', but I thought the
> explanation like below would be useful.
>
> Ok. I added an explanation of this column in the documentation.


> > I have added this information as a column named "num_agg_contexts",
> > which indicates
> > the number of contexts whose statistics have been aggregated/added for
> > a particular output.
>
> git apply caused some warnings:
>
> Thank you for reporting. They should be gone now.

PFA the patch with above updates.

Thank you,
Rahila Syed

Attachment: v9-0001-Function-to-report-memory-context-stats-of-any-backe.patch
Description: Binary data

Reply via email to