Re: Parent/child context relation in pg_get_backend_memory_contexts()

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>, torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Parent/child context relation in pg_get_backend_memory_contexts()
Date: 2024-04-04 01:44:27
Message-ID: CAApHDvrqeE+RzFiZGP5-2+VWQ18jjW5jbN0eS3+8CR-zHYTWrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 4 Apr 2024 at 12:34, Michael Paquier <michael(at)paquier(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-04-04 01:58:48 Re: Refactoring of pg_resetwal/t/001_basic.pl
Previous Message Michael Paquier 2024-04-04 01:41:47 Re: Add new error_action COPY ON_ERROR "log"