Re: CLUSTER command

From: Richard Hipp <drh(at)sqlite(dot)org>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: CLUSTER command
Date: 2024-10-16 09:37:29
Message-ID: TCgULAWzNqO5HbRsxvrkl6921-V0y5Eelw29npFyc6fjqS1aHAQS8ndNDLwu7L--_jj27YW_DM0yu_YS6fsCIDC0H4GdSPCtPfpPYrn61Bo=@sqlite.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

That makes perfect sense, now that you have explained it. I just didn't pick up on that from the text as written.

--
D. Richard Hipp
drh(at)sqlite(dot)org

On Wednesday, October 16th, 2024 at 9:22 AM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:

> Hello,
>
> On 2024-Oct-15, PG Doc comments form wrote:
>
> > The documentation does not say what happens if you do "CLUSTER tablename"
> > and omit the USING clause, which is shown as optional in the BNF, if I'm
> > reading it right. Does CLUSTER use the PRIMARY KEY in that case? What if
> > no PRIMARY KEY is specified?
>
>
> The table is clustered on the index that was previously selected as the
> cluster index (either by running "CLUSTER table ON idx" or by doing
> ALTER TABLE tab CLUSTER ON idx"). If no index is selected, an error is
> thrown.
>
> The docs explain it this way:
>
> When a table is clustered, PostgreSQL remembers which index it was clustered
> by. The form CLUSTER table_name reclusters the table using the same index as
> before. You can also use the CLUSTER or SET WITHOUT CLUSTER forms of ALTER
> TABLE to set the index to be used for future cluster operations, or to clear
> any previous setting.
>
> I'm not sure if we need to make this clearer. It's perfectly clear to
> me, but then I already knew what I wanted to read ...
>
> --
> Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
> "After a quick R of TFM, all I can say is HOLY CR** THAT IS COOL! PostgreSQL was
> amazing when I first started using it at 7.2, and I'm continually astounded by
> learning new features and techniques made available by the continuing work of
> the development team."
> Berend Tober, http://archives.postgresql.org/pgsql-hackers/2007-08/msg01009.php

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Daniel Gustafsson 2024-10-16 09:49:57 Re: missing command?
Previous Message Alvaro Herrera 2024-10-16 09:22:48 Re: CLUSTER command