summaryrefslogtreecommitdiff
path: root/src/include/nodes/memnodes.h
diff options
context:
space:
mode:
authorDavid Rowley2024-07-25 03:03:28 +0000
committerDavid Rowley2024-07-25 03:03:28 +0000
commit32d3ed8165f821f6994c95230a9a4b2ff0ce9f12 (patch)
treee0372387e67360550b55183841950833cfe478c9 /src/include/nodes/memnodes.h
parent64c39bd5047e6ee045bbc80ea1399feb59cd2b53 (diff)
Add path column to pg_backend_memory_contexts view
"path" provides a reliable method of determining the parent/child relationships between memory contexts. Previously this could be done in a non-reliable way by writing a recursive query and joining the "parent" and "name" columns. This wasn't reliable as the names were not unique, which could result in joining to the wrong parent. To make this reliable, "path" stores an array of numerical identifiers starting with the identifier for TopLevelMemoryContext. It contains an element for each intermediate parent between that and the current context. Incompatibility: Here we also adjust the "level" column to make it 1-based rather than 0-based. A 1-based level provides a convenient way to access elements in the "path" array. e.g. path[level] gives the identifier for the current context. Identifiers are not stable across multiple evaluations of the view. In an attempt to make these more stable for ad-hoc queries, the identifiers are assigned breadth-first. Contexts closer to TopLevelMemoryContext are less likely to change between queries and during queries. Author: Melih Mutlu <[email protected]> Discussion: https://postgr.es/m/CAGPVpCThLyOsj3e_gYEvLoHkr5w=tadDiN_=z2OwsK3VJppeBA@mail.gmail.com Reviewed-by: Andres Freund, Stephen Frost, Atsushi Torikoshi, Reviewed-by: Michael Paquier, Robert Haas, David Rowley
Diffstat (limited to 'src/include/nodes/memnodes.h')
-rw-r--r--src/include/nodes/memnodes.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/nodes/memnodes.h b/src/include/nodes/memnodes.h
index c4c9fd3e3e1..addfbb1ccdf 100644
--- a/src/include/nodes/memnodes.h
+++ b/src/include/nodes/memnodes.h
@@ -128,8 +128,8 @@ typedef struct MemoryContextData
MemoryContext firstchild; /* head of linked list of children */
MemoryContext prevchild; /* previous child of same parent */
MemoryContext nextchild; /* next child of same parent */
- const char *name; /* context name (just for debugging) */
- const char *ident; /* context ID if any (just for debugging) */
+ const char *name; /* context name */
+ const char *ident; /* context ID if any */
MemoryContextCallback *reset_cbs; /* list of reset/delete callbacks */
} MemoryContextData;