Re: BUG #19686: Rolling back SET TABLESPACE

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Alexandre Felipe <o(dot)alexandre(dot)felipe(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19686: Rolling back SET TABLESPACE
Date: 2026-09-30 00:08:58
Message-ID: arxTGn_8Fb9JLM0e@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 29, 2026 at 07:39:40PM -0400, Tom Lane wrote:
> That seems like the logical solution to me. Nobody will be surprised
> if ALTER SET TABLESPACE takes a long time for a big table; at least
> not if they understand that it requires copying the data somewhere
> else. Imposing costs at COMMIT time might well surprise people.

Yes, putting the cost within the ALTER TABLE would feel less
surprising.

> The one disadvantage I see is that (I imagine) a common use-case is
> to move both a table and its indexes to a new tablespace, and this
> solution will imply that that sequence double-copies the indexes.
> Maybe it'd be worth providing a command variant that copies the
> table and its indexes to a new tablespace in one step. But that
> is a future optimization, not part of the bug fix; and I could be
> wrong about whether anyone even cares.

And it's something that would qualify as a new feature, not really
backpatchable. At least it feels risky compared to the idea of
copying the index relfilenode.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Michael Paquier 2026-09-30 00:02:42 Re: [PATCH] Clear FatalError earlier during crash restart