Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>, Steve Singer <steve(at)ssinger(dot)info>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Jose Luis Tallon <jltallon(at)adv-solutions(dot)net>
Subject: Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly
Date: 2021-02-03 10:54:42
Message-ID: YBqA8snxOp2lXLyl@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-02-03 11:01:14 Re: logical replication worker accesses catalogs in error context callback
Previous Message Fujii Masao 2021-02-03 10:52:26 Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit