Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAxbz-0000Nn-Ly for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Sep 2019 14:40:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iAxby-0002gD-ED for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Sep 2019 14:40:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAxby-0002g3-1M for pgsql-hackers@lists.postgresql.org; Thu, 19 Sep 2019 14:40:46 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iAxbv-0001ku-2o for pgsql-hackers@postgresql.org; Thu, 19 Sep 2019 14:40:45 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id A206421C4144; Thu, 19 Sep 2019 17:40:41 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.223] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 654D321C4140; Thu, 19 Sep 2019 17:40:41 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1568904041; bh=wQS+sL/xEblXkKdbxgO2ENeYmgInSj/EMLmT6gBHnLg=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=Y2HB/Y3+D2rCN2k/YzT1CeYoGf+5cEiuGi1bM10WeZtoAzRtPwy9b6S8s9RVofXYm BA/z8YOYZ7LIMn9BxJwRWWjy3Zsg4CfyHAQvzQ/q82K/mKHdFHAQrU9u0dp7hpRHrV p1fkxhhOfHMWi/q3vi0/Q1wIHUkVpRAvd8DRRV4c= Subject: Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly To: Robert Haas , Michael Paquier Cc: Surafel Temesgen , Alexander Korotkov , Masahiko Sawada , Alvaro Herrera , PostgreSQL Hackers References: <20181227132417.xe3oagawina7775b@alvherre.pgsql> <6b2a5c4de19f111ef24b63428033bb67@postgrespro.ru> <34493046-cbda-3262-2ff9-4189bccfb862@postgrespro.ru> <20190919044300.GB21144@paquier.xyz> From: Alexey Kondratov Message-ID: Date: Thu, 19 Sep 2019 17:40:41 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 19.09.2019 16:21, Robert Haas wrote: > On Thu, Sep 19, 2019 at 12:43 AM Michael Paquier wrote: >> It seems to me that it would be good to keep the patch as simple as >> possible for its first version, and split it into two if you would >> like to add this new option instead of bundling both together. This >> makes the review of one and the other more simple. Anyway, regarding >> the grammar, is SET TABLESPACE really our best choice here? What >> about: >> - TABLESPACE = foo, in parenthesis only? >> - Only using TABLESPACE, without SET at the end of the query? >> >> SET is used in ALTER TABLE per the set of subqueries available there, >> but that's not the case of REINDEX. > So, earlier in this thread, I suggested making this part of ALTER > TABLE, and several people seemed to like that idea. Did we have a > reason for dropping that approach? If we add this option to REINDEX, then for 'ALTER TABLE tb_name action1, REINDEX SET TABLESPACE tbsp_name, action3' action2 will be just a direct alias to 'REINDEX TABLE tb_name SET TABLESPACE tbsp_name'. So it seems practical to do this for REINDEX first. The only one concern I have against adding REINDEX to ALTER TABLE in this context is that it will allow user to write such a chimera: ALTER TABLE tb_name REINDEX SET TABLESPACE tbsp_name, SET TABLESPACE tbsp_name; when they want to move both table and all the indexes. Because simple ALTER TABLE tb_name REINDEX, SET TABLESPACE tbsp_name; looks ambiguous. Should it change tablespace of table, indexes or both? -- Alexey Kondratov Postgres Professional https://www.postgrespro.com Russian Postgres Company