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

From: Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>
To: Surafel Temesgen <surafel3000(at)gmail(dot)com>
Cc: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly
Date: 2019-09-18 12:46:20
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Surafel,

Thank you for looking at the patch!

On 17.09.2019 14:04, Surafel Temesgen wrote:
> * There are NOWAIT option in alter index, is there a reason not to
> have similar option here?

Currently in Postgres SET TABLESPACE always comes with [ NOWAIT ]
option, so I hope it worth adding this option here for convenience.
Added in the new version.

> * SET TABLESPACE command is not documented

Actually, new_tablespace parameter was documented, but I've added a more
detailed section for SET TABLESPACE too.

> * There are multiple checking for whether the relation is temporary
> tables of other sessions, one in check_relation_is_movable and other
> independently

Yes, and there is a comment section in the code describing why. There is
a repeatable bunch of checks for verification whether relation movable
or not, so I put it into a separated function --
check_relation_is_movable. However, if we want to do only REINDEX, then
some of them are excess, so the only one RELATION_IS_OTHER_TEMP is used.
Thus, RELATION_IS_OTHER_TEMP is never executed twice, just different
code paths.

> *+ char *tablespacename;
> calling it new_tablespacename will make it consistent with other places

OK, changed, although I don't think it is important, since this is the
only one tablespace variable there.

> *The patch did't applied cleanly

Patch is rebased and attached with all the fixes described above.


Alexey Kondratov

Postgres Professional
Russian Postgres Company

Attachment Content-Type Size
v2-0001-Allow-REINDEX-and-REINDEX-CONCURRENTLY-to-SET-TAB.patch text/x-patch 32.2 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2019-09-18 12:51:09 Re: patch: psql - enforce constant width of last column
Previous Message Peter Eisentraut 2019-09-18 12:31:39 Re: Nondeterministic collations vs. text_pattern_ops