Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJEZ6-0007cZ-TG for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2020 10:56:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJEZ4-0007W5-Ru for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2020 10:56:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJEZ4-0007Vx-GV for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2020 10:56:14 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJEZ1-0008TT-10 for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2020 10:56:13 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 29ECC21C5718; Tue, 31 Mar 2020 13:56:08 +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 mail.postgrespro.ru (cyclops.l.postgrespro.ru [192.168.27.1]) (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 D36B321C4D84; Tue, 31 Mar 2020 13:56:07 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1585652168; bh=OKWCHh0RGS318SQ2230j5l0PE5BDknT/MkWDBfVL2OE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=TlAwjg0qQp3Gt7K1V51vOApHHCcI2zWDYEDg6godmbpBEWPyr7kvfRUZ/8W9Vbjn9 KxocKucYN8BrdqnKoz5X49g4QWECSExe53I5CQE1syCU3/FohyavJD5jSiQ9yyuBI6 MsgDlfjFg0PggVATrjH38RfxUT5LJzF7e82c8T7E= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 31 Mar 2020 13:56:07 +0300 From: Alexey Kondratov To: Justin Pryzby Cc: Michael Paquier , Masahiko Sawada , Steve Singer , pgsql-hackers@lists.postgresql.org, Alvaro Herrera , Robert Haas , Alexander Korotkov , Masahiko Sawada , Jose Luis Tallon Subject: Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly In-Reply-To: <20200330183439.GQ20103@telsasoft.com> References: <20200229145304.GI29456@telsasoft.com> <20200309200447.GA32459@telsasoft.com> <20200325234027.GH21443@telsasoft.com> <39a055a7a8cd19552f35f4cb98a8cd80@postgrespro.ru> <20200326180112.GH17431@telsasoft.com> <20200327040106.GC20103@telsasoft.com> <20200328001112.GX20103@telsasoft.com> <20200330183439.GQ20103@telsasoft.com> User-Agent: Roundcube Webmail/1.4.0 Message-ID: <624921b1ebca9897173d85c424c00646@postgrespro.ru> X-Sender: a.kondratov@postgrespro.ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-03-30 21:34, Justin Pryzby wrote: > On Mon, Mar 30, 2020 at 09:02:22PM +0300, Alexey Kondratov wrote: >> Hmm, I went through the well known to me SQL commands in Postgres and >> a bit >> more. Parenthesized options list is mostly used in two common cases: > > There's also ANALYZE(VERBOSE), REINDEX(VERBOSE). > There was debate a year ago [0] as to whether to make "reindex > CONCURRENTLY" a > separate command, or to use parenthesized syntax "REINDEX > (CONCURRENTLY)". I > would propose to support that now (and implemented that locally). > I am fine with allowing REINDEX (CONCURRENTLY), but then we will have to support both syntaxes as we already do for VACUUM. Anyway, if we agree to add parenthesized options to REINDEX/CLUSTER, then it should be done as a separated patch before the current patch set. > > ..and explain(...) > >> - In the beginning for boolean options only, e.g. VACUUM > > You're right that those are currently boolean, but note that > explain(FORMAT ..) > is not boolean. > Yep, I forgot EXPLAIN, this is a good example. > > .. and create table (LIKE ..) > LIKE is used in the table definition, so it is a slightly different case. > >> Putting it into the WITH (...) options list looks like an option to >> me. >> However, doing it only for VACUUM will ruin the consistency, while >> doing it >> for CLUSTER and REINDEX is not necessary, so I do not like it either. > > It's not necessary but I think it's a more flexible way to add new > functionality (requiring no changes to the grammar for vacuum, and for > REINDEX/CLUSTER it would allow future options to avoid changing the > grammar). > > If we use parenthesized syntax for vacuum, my proposal is to do it for > REINDEX, and > consider adding parenthesized syntax for cluster, too. > >> To summarize, currently I see only 2 + 1 extra options: >> >> 1) Keep everything with syntax as it is in 0001-0002 >> 2) Implement tail syntax for VACUUM, but with limitation for VACUUM >> FULL of >> the entire database + TABLESPACE change >> 3) Change TABLESPACE to a fully reserved word > > + 4) Use parenthesized syntax for all three. > > Note, I mentioned that maybe VACUUM/CLUSTER should support not only > "TABLESPACE > foo" but also "INDEX TABLESPACE bar" (I would use that, too). I think > that > would be easy to implement, and for sure it would suggest using () for > both. > (For sure we don't want to implement "VACUUM t TABLESPACE foo" now, and > then > later implement "INDEX TABLESPACE bar" and realize that for consistency > we > cannot parenthesize it. > > Michael ? Alvaro ? Robert ? > Yes, I would be glad to hear other opinions too, before doing this preliminary refactoring. -- Alexey Kondratov Postgres Professional https://www.postgrespro.com Russian Postgres Company