aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeModifyTable.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2024-07-25 15:03:28 +1200
committerDavid Rowley <drowley@postgresql.org>2024-07-25 15:03:28 +1200
commit32d3ed8165f821f6994c95230a9a4b2ff0ce9f12 (patch)
treee0372387e67360550b55183841950833cfe478c9 /src/backend/executor/nodeModifyTable.c
parent64c39bd5047e6ee045bbc80ea1399feb59cd2b53 (diff)
downloadpostgresql-32d3ed8165f821f6994c95230a9a4b2ff0ce9f12.tar.gz
postgresql-32d3ed8165f821f6994c95230a9a4b2ff0ce9f12.zip
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 <m.melihmutlu@gmail.com> 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/backend/executor/nodeModifyTable.c')
0 files changed, 0 insertions, 0 deletions