Do we still need parent column in pg_backend_memory_context? - Mailing list pgsql-hackers

From Melih Mutlu
Subject Do we still need parent column in pg_backend_memory_context?
Date
Msg-id CAGPVpCT7NOe4fZXRL8XaoxHpSXYTu6GTpULT_3E-HT9hzjoFRA@mail.gmail.com
Whole thread Raw
Responses Re: Do we still need parent column in pg_backend_memory_context?
List 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.



Regards,
--
Melih Mutlu
Microsoft
Attachment

pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Re: New compiler warnings in buildfarm
Next
From: Nathan Bossart
Date:
Subject: remove volatile qualifiers from pg_stat_statements