On 2018-Jun-14, Andres Freund wrote:
> But I do think there's a few things that are doable without actually
> needing to invoke any user defined code aside of the AM code
> itself. E.g. heap pruning / aggressively setting hint bits doesn't need
> to invoke operators, and I can think of some ways to implement index
> delete marking that does so without invoking any comparators either.
So what you want to do is have bgwriter/checkpointer able to scan some
catalog and grab a function pointer that can "execute pruning on this
shared buffer", right? For that maybe we need to split out a part of
AMs that is storage-level and another one that is data-level. So an
access method would create two catalog entries, one of which is shared
(pg_shared_am? ugh) and the other is the regular one we already have in
pg_am. The handler function in pg_shared_am gives you functions that
can only do storage-level stuff such as hint bit setting, page pruning,
tuple freezing, CRC, etc which does not require access to the data
itself.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services