Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Alexey Kondratov <a.kondratov@postgrespro.ru>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Masahiko Sawada <masahiko.sawada@2ndquadrant.com>, Steve Singer <steve@ssinger.info>, pgsql-hackers@lists.postgresql.org, Robert Haas <robertmhaas@gmail.com>, Alexander Korotkov <a.korotkov@postgrespro.ru>, Masahiko Sawada <sawada.mshk@gmail.com>, Jose Luis Tallon <jltallon@adv-solutions.net>
Date: 2021-02-03T10:54:42Z
Lists: pgsql-hackers
On Wed, Feb 03, 2021 at 12:53:42AM -0600, Justin Pryzby wrote:
> On Wed, Feb 03, 2021 at 03:37:39PM +0900, Michael Paquier wrote:
>> index 627b36300c..4ee3951ca0 100644
>> --- a/doc/src/sgml/ref/reindex.sgml
>> +++ b/doc/src/sgml/ref/reindex.sgml
>> @@ -293,8 +311,30 @@ REINDEX [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] { IN
>> respectively. Each partition of the specified partitioned relation is
>> reindexed in a separate transaction. Those commands cannot be used inside
>> a transaction block when working on a partitioned table or index.
>> + If a <command>REINDEX</command> command fails when run on a partitioned
>> + relation, and <literal>TABLESPACE</literal> was specified, then it may not
>> + have moved all indexes to the new tablespace. Re-running the command
>> + will rebuild again all the partitions and move previously-unprocessed
>
> remove "again"
Okay.
>> + indexes to the new tablespace.
>> + </para>
>> +
>> + <para>
>> + When using the <literal>TABLESPACE</literal> clause with
>> + <command>REINDEX</command> on a partitioned index or table, only the
>> + tablespace references of the partitions are updated. As partitioned indexes
>
> I think you should say "of the LEAF partitions ..". The intermediate,
> partitioned tables are also "partitions" (partitioned partitions if you like).
Indeed, I can see how that's confusing.
>> + are not updated, it is recommended to separately use
>> + <command>ALTER TABLE ONLY</command> on them to achieve that.
>
> Maybe say: "..to set the default tablespace of any new partitions created in
> the future".
Not sure I like that. Here is a proposal:
"it is recommended to separately use ALTER TABLE ONLY on them so as
any new partitions attached inherit the new tablespace value."
--
Michael
Commits
-
Add TABLESPACE option to REINDEX
- c5b286047cd6 14.0 landed
-
Refactor code in tablecmds.c to check and process tablespace moves
- 4c9c359d38ff 14.0 landed
-
Refactor option handling of CLUSTER, REINDEX and VACUUM
- a3dc926009be 14.0 landed
-
pg_dump: Don't use enums for defining bit mask values
- d2a2808eb444 14.0 landed
-
Refactor CLUSTER and REINDEX grammar to use DefElem for option lists
- b5913f612079 14.0 landed
-
Refactor parsing rules for option lists of EXPLAIN, VACUUM and ANALYZE
- 873ea9ee692e 14.0 landed
-
Improve tab completion of REINDEX in psql
- 1f75b454134c 14.0 landed
-
Fix possible crash during FATAL exit from reindexing.
- d12bdba77b0f 13.0 cited