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

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
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-01-25 12:58:49
Message-ID: 20210125125849.GA30745@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 25, 2021 at 05:07:29PM +0900, Michael Paquier wrote:
> On Fri, Jan 22, 2021 at 05:07:02PM +0300, Alexey Kondratov wrote:
> > I have updated patches accordingly and also simplified tablespaceOid checks
> > and assignment in the newly added SetRelTableSpace(). Result is attached as
> > two separate patches for an ease of review, but no objections to merge them
> > and apply at once if everything is fine.
...
> +SELECT relname FROM pg_class
> +WHERE reltablespace=(SELECT oid FROM pg_tablespace WHERE spcname='regress_tblspace');
> [...]
> +-- first, check a no-op case
> +REINDEX (TABLESPACE pg_default) INDEX regress_tblspace_test_tbl_idx;
> +REINDEX (TABLESPACE pg_default) TABLE regress_tblspace_test_tbl;
> Reindexing means that the relfilenodes are changed, so the tests
> should track the original and new relfilenodes and compare them, no?
> In short, this set of regression tests does not make sure that a
> REINDEX actually happens or not, and this may read as a reindex not
> happening at all for those tests. For single units, these could be
> saved in a variable and compared afterwards. create_index.sql does
> that a bit with REINDEX SCHEMA for a set of relations.

You might also check my "CLUSTER partitioned" patch for another way to do that.

https://www.postgresql.org/message-id/20210118183459.GJ8560%40telsasoft.com
https://www.postgresql.org/message-id/attachment/118126/v6-0002-Implement-CLUSTER-of-partitioned-table.patch

--
Justin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2021-01-25 13:08:15 Re: Bug in error reporting for multi-line JSON
Previous Message Pavel Borisov 2021-01-25 12:32:31 Re: [PATCH] Automatic HASH and LIST partition creation