Re: Align memory context level numbering in pg_log_backend_memory_contexts()
От | David Rowley |
---|---|
Тема | Re: Align memory context level numbering in pg_log_backend_memory_contexts() |
Дата | |
Msg-id | CAApHDvpE6JS9F5kg+W4+p9TsiqFsPE+6XqEtD0P0HKNBoa9tYA@mail.gmail.com обсуждение исходный текст |
Ответ на | Align memory context level numbering in pg_log_backend_memory_contexts() (torikoshia <torikoshia@oss.nttdata.com>) |
Ответы |
Re: Align memory context level numbering in pg_log_backend_memory_contexts()
|
Список | pgsql-hackers |
On Wed, 16 Apr 2025 at 01:23, torikoshia <torikoshia@oss.nttdata.com> wrote: > =# select name, level from pg_backend_memory_contexts; > name | level > ----------------------------+------- > TopMemoryContext | 1 > =# select pg_log_backend_memory_contexts(pg_backend_pid()); > > LOG: level: 0; TopMemoryContext: ... > However, for the sake of consistency and to avoid potential confusion, > would it make sense to also start the levels from 1 in > pg_log_backend_memory_contexts() starting in v18? That's not a very nice inconsistency. As for which one is changed... Quite a bit of thought and discussion occurred before 32d3ed81 to try to make the "path" and "level" columns as easy to use as possible, and making "level" 1-based was done as a result of trying to make queries that sum up a context and its children as easy as possible. The example at the end of [1] would be a little more complex with 0-based levels as we'd have to use level+1 as the index. My vote is to make the levels 1-based in all locations where we output the context information. Does anyone else have views on this? David [1] https://www.postgresql.org/docs/devel/view-pg-backend-memory-contexts.html
В списке pgsql-hackers по дате отправления: