index access method documentation light on details on ii_AmCache

Поиск
Список
Период
Сортировка
От PG Doc comments form
Тема index access method documentation light on details on ii_AmCache
Дата
Msg-id 169454016225.2433963.11433530945607791340@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: index access method documentation light on details on ii_AmCache  ("Euler Taveira" <euler@eulerto.com>)
Список pgsql-docs
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/index-functions.html
Description:

So, if I cache something in ii_AmCache during a call to my aminsert
callback...

When, if ever, does it get freed?

Having looked at example code, I don't actually see anything doing this in
insert paths, so presumably there's some point at which this happens
automatically, possibly as part of the Memory Context thing, maybe related
to the ii_Context which seems to be getting used, but I can't find anything
anywhere documenting that. This may well be completely obvious, or intended
to be implied by "it can allocate space in indexInfo->ii_Context", but it's
not exceptionally obvious to me as a newcomer to the code. (By contrast, the
ambuild docs say to palloc a data structure, but don't mention a context for
it; no idea whether it should be in a particular context.)

Actually, in full generality, I have not been able to find a section of the
documentation which explains the memory-context stuff at all. I found a blog
post elsewhere suggesting that it's just "the memory context will be freed
and thus everything associated with it". This implies that there's no
straightforward way for an index to do end-of-insert maintenance after all
the inserts from a given query are complete, except to do it after every
tuple just in case it's the last tuple, I guess?

В списке pgsql-docs по дате отправления:

Предыдущее
От: "Euler Taveira"
Дата:
Сообщение: Re: Kernel settings shmall
Следующее
От: "Euler Taveira"
Дата:
Сообщение: Re: index access method documentation light on details on ii_AmCache