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 1j0TQ9-0007rQ-TW for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Feb 2020 16:57:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j0TQ8-0004po-CC for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Feb 2020 16:57:28 +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 1j0TQ8-0004o7-3h for pgsql-hackers@lists.postgresql.org; Sat, 08 Feb 2020 16:57:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j0TQ1-0003eO-E0 for pgsql-hackers@postgresql.org; Sat, 08 Feb 2020 16:57:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 018Gv9n8010985; Sat, 8 Feb 2020 11:57:09 -0500 From: Tom Lane To: Justin Pryzby cc: Alvaro Herrera , Alexey Kondratov , Robert Haas , Michael Paquier , Amit Langote , pgsql-hackers@postgresql.org Subject: Re: ALTER TABLE rewrite to use clustered order In-reply-to: <20200208150453.GV403@telsasoft.com> References: <20200208150453.GV403@telsasoft.com> Comments: In-reply-to Justin Pryzby message dated "Sat, 08 Feb 2020 09:04:53 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10983.1581181029.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 08 Feb 2020 11:57:09 -0500 Message-ID: <10984.1581181029@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Justin Pryzby writes: > On Thu, Dec 27, 2018 at 10:24:17AM -0300, Alvaro Herrera wrote: >> I think it would be valuable to have those ALTER TABLE variants that re= write >> the table do so using the cluster order, if there is one, instead of th= e heap >> order, which is what it does today. > That's a neat idea. TBH, I'm -1 on this. The current behavior of preserving physical order is perfectly sane, and it's faster than anything involving CLUSTER is going to be, and if you try to change that you are going to have enormous headaches with the variants of ALTER TABLE that would change the semantics of the CLUSTER index columns. (Unless of course your theory is that you don't actually care exactly what the finished order is, in which case why are we bothering?) The proposed patch which *forces* it to be done like that, whether the user wants it or not, seems particularly poorly thought out. regards, tom lane