On Wed, Sep 17, 2025 at 12:23 PM Tomas Vondra <tomas@vondra.me> wrote:
> Look at the BRIN code, for example. Most of the parallel stuff happens
> in _brin_begin_parallel. Maybe more of it could be generalized a bit
> more (some of the shmem setup?). But most of it is tied to the
> AM-specific state / how parallel builds work for that particular AM.
Well, the code for PARALLEL_KEY_WAL_USAGE, PARALLEL_KEY_BUFFER_USAGE,
and PARALLEL_KEY_QUERY_TEXT is duplicated, for instance. That's not a
ton of code, perhaps, but it may evolve over time, and having to keep
copies for a bunch of different AMs in sync is not ideal.
--
Robert Haas
EDB: http://www.enterprisedb.com