Hi,
On 2026-10-02 14:18:00 -0300, Manu wrote:
> The indexes only need to share the heap's rewrite when the table is
> modified again in the same transaction, which is also the only time the
> corruption can arise. So leave SET TABLESPACE itself alone, and give an
> index a new relfilenumber -- copying it within its own tablespace, as
> documented, the indexes stay where they are -- when the executor opens
> it to modify a table whose storage was replaced in the current
> transaction
I'm pretty doubtful that is a good idea. For one it'll make the performance
effects very hard to understand. Having a single insert suddenly taking an
hour will confuse folks rather profoundly.
I also suspect there might be some correctness issues, because you could have
nested queries where the outer query has an in-progress index scan or such and
then a query within e.g. a plpgsql function does an insert. The outer query
might have some buffers of the "old" index pinned etc, which certainly would
not make it safe to just move the relfilenode underneath.
Greetings,
Andres Freund