agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Alexandre Felipe <o.alexandre.felipe@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: BUG #19686: Rolling back SET TABLESPACE
Date: Tue, 29 Sep 2026 19:39:40 -0400
Message-ID: <714053.1790725180@sss.pgh.pa.us> (raw)
In-Reply-To: <lqlli2yiai6dimhlzm47qiwuiz3qczt7snhzkx6qvrmmbltw6w@i7pvrw556qwg>
References: <CAE8JnxP+Ubdj-kaxfgNt=3_FzD3GgOc3gEvPAvrXKfgTgH2q5w@mail.gmail.com>
<lqlli2yiai6dimhlzm47qiwuiz3qczt7snhzkx6qvrmmbltw6w@i7pvrw556qwg>
Andres Freund <andres@anarazel.de> writes:
> I don't think copying the file at commit is a good path, we shouldn't make
> commits take arbitrarily long without pretty darn good reason. I don't think
> this is that.
+1. Moving operations with a significant probability of failure into
COMMIT is also an anti-pattern.
> What about forcing indexes to be copied to a new relfilenode when copying the
> underlying table?
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.
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.
regards, tom lane
view thread (30+ messages) latest in thread
Message-ID: <714053.1790725180@sss.pgh.pa.us>
Permalink: ../714053.1790725180@sss.pgh.pa.us/
Also on: postgresql.org/message-id/714053.1790725180@sss.pgh.pa.us
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, o.alexandre.felipe@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: BUG #19686: Rolling back SET TABLESPACE
In-Reply-To: <714053.1790725180@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox