Re: Parent/child context relation in pg_get_backend_memory_contexts() - Mailing list pgsql-hackers

From David Rowley
Subject Re: Parent/child context relation in pg_get_backend_memory_contexts()
Date
Msg-id CAApHDvrqeE+RzFiZGP5-2+VWQ18jjW5jbN0eS3+8CR-zHYTWrQ@mail.gmail.com
Whole thread Raw
In response to Re: Parent/child context relation in pg_get_backend_memory_contexts()  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Parent/child context relation in pg_get_backend_memory_contexts()
List pgsql-hackers
On Thu, 4 Apr 2024 at 12:34, Michael Paquier <michael@paquier.xyz> wrote:
> I've been re-reading the patch again to remember what this is about,
> and I'm OK with having this "path" column in the catalog.  However,
> I'm somewhat confused by the choice of having a temporary number that
> shows up in the catalog representation, because this may not be
> constant across multiple calls so this still requires a follow-up
> temporary ID <-> name mapping in any SQL querying this catalog.  A
> second thing is that array does not show the hierarchy of the path;
> the patch relies on the order of the elements in the output array
> instead.

My view on this is that there are a couple of things with the patch
which could be considered separately:

1. Should we have a context_id in the view?
2. Should we also have an array of all parents?

My view is that we really need #1 as there's currently no reliable way
to determine a context's parent as the names are not unique.   I do
see that Melih has mentioned this is temporary in:

+      <para>
+       Current context id. Note that the context id is a temporary id and may
+       change in each invocation
+      </para></entry>

For #2, I'm a bit less sure about this. I know Andres would like to
see this array added, but equally WITH RECURSIVE would work.  Does the
array of parents completely eliminate the need for recursive queries?
I think the array works for anything that requires all parents or some
fixed (would be) recursive level, but there might be some other
condition to stop recursion other than the recursion level that
someone needs to do.    What I'm trying to get at is; do we need to
document the WITH RECURSIVE stuff anyway? and if we do, is it still
worth having the parents array?

David



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Add new error_action COPY ON_ERROR "log"
Next
From: Michael Paquier
Date:
Subject: Re: Refactoring of pg_resetwal/t/001_basic.pl