index access method documentation light on details on ii_AmCache

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: postgresql(at)seebs(dot)net
Subject: index access method documentation light on details on ii_AmCache
Date: 2023-09-12 17:36:02
Message-ID: 169454016225.2433963.11433530945607791340@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Euler Taveira 2023-09-13 18:48:41 Re: index access method documentation light on details on ii_AmCache
Previous Message Euler Taveira 2023-09-12 14:57:49 Re: Kernel settings shmall