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: v1-0001-Remove-parent-from-pg_backend_memory_context.patch
Description: Binary data

Reply via email to