Do we still need parent column in pg_backend_memory_context?

From: Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Do we still need parent column in pg_backend_memory_context?
Date: 2024-07-30 17:19:30
Message-ID: CAGPVpCT7NOe4fZXRL8XaoxHpSXYTu6GTpULT_3E-HT9hzjoFRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

After the patch [1] that adds a path column to pg_backend_memory_context,
the parent context can also be found in the path array. Since there are
currently two ways to retrieve information related to the parent of a
context, I wonder whether we still want to keep the parent column.

The path column represents the path from TopMemoryContext to the current
memory context. There is always "level" number of elements in a path array
for any memory context. The first element in the array is TopMemoryContext,
and the last element (path[level]) is the current memory context. The
path[level-1] element will simply show us the parent context ID.

I understand that having the parent name instead of the transient parent
context ID can be easier to use in some cases. While I suspect that the
memory contexts most users are interested in are close to
TopMemoryContext—which means their context IDs are much less likely to
change with each execution—it's still not guaranteed.

I'm also unsure how common it is to use or rely on the parent column. I
quickly searched here [2] to see how pg_backend_memory_context is used.
There are a few places where the parent column is used in extensions. I
believe these places should be easy to update if we decide to remove the
parent column.

Attached is a patch to remove parent from the view.

[1]
https://www.postgresql.org/message-id/CAGPVpCThLyOsj3e_gYEvLoHkr5w%3DtadDiN_%3Dz2OwsK3VJppeBA%40mail.gmail.com
[2]
https://codesearch.debian.net/search?q=pg_backend_memory_context&literal=1&page=3

Regards,
--
Melih Mutlu
Microsoft

Attachment Content-Type Size
v1-0001-Remove-parent-from-pg_backend_memory_context.patch application/octet-stream 3.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-07-30 18:24:54 remove volatile qualifiers from pg_stat_statements
Previous Message Ranier Vilela 2024-07-30 16:56:16 Re: New compiler warnings in buildfarm