Re: ALTER TABLE rewrite to use clustered order

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Amit Langote <amitlangote09gmailcom(at)telsasoft(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE rewrite to use clustered order
Date: 2020-02-08 16:57:09
Message-ID: 10984.1581181029@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Justin Pryzby <pryzby(at)telsasoft(dot)com> 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 rewrite
>> the table do so using the cluster order, if there is one, instead of the 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2020-02-08 16:59:37 Re: Index Skip Scan
Previous Message Tomas Vondra 2020-02-08 16:53:23 Re: Internal key management system