Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t10F8-00EDmS-TQ for pgsql-docs@arkaria.postgresql.org; Wed, 16 Oct 2024 09:22:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t10F7-000uR4-6k for pgsql-docs@arkaria.postgresql.org; Wed, 16 Oct 2024 09:22:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t10F6-000uQv-AE for pgsql-docs@lists.postgresql.org; Wed, 16 Oct 2024 09:22:57 +0000 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t10F3-0019cV-PJ for pgsql-docs@lists.postgresql.org; Wed, 16 Oct 2024 09:22:55 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 1074211401BF; Wed, 16 Oct 2024 05:22:53 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 16 Oct 2024 05:22:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1729070573; x=1729156973; bh=K C7N9ZJ6mouM8Ab55rcBC7b5tJSSnKKMVq/79LaC6Xc=; b=beOuCA8mdAc6SxoZ/ jFiE3spXg27hBTAlfZbzwW9aKJKd4y//fhi+sGe8o0lx83/kkx1e3kv3DsFVRAjp tuM8JW+GjBjmiw/DEt0kL65WgSezwJ4qqci8RS5nUJA+QrkNyH0OUkQMQhv4urTg hFkvSqQVYY00Twkq6CxYt9jN0/wPvVl/rkt2bKo3MTsWpm0T+/8iTU5XNeaDSPme o2tx3TWyfiWTUeHr0yjz8tEy8/YjLeTpA87c9pHwNXySPp6EG8XEui36qRjsW0Wx 1ZhWjtpCzJuNUviA0mWS6ZdjLILyHk2vGWWbxdkPAYcyRTcgHUmJNB7WCXboSqYe VzbYg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdegledgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuf fkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgr uceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvg hrnhepfeduleekteeigfegledtvddvvddtledugfefhfdtieevteeftdeuueehudeuvdel necuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhdpphhoshhtghhrvghsqh hlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspghrtghpthhtoh epvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphhgshhqlhdqughotghssehl ihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopegurhhhsehsqhhlih htvgdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 16 Oct 2024 05:22:52 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1729070568; bh=an8rN9h+x/OSvXkoLX1NkVBgypHllPv1to5IvnrZJkQ=; h=Date:From:To:Subject:In-Reply-To:From; b=omZd9qQeZE3EzkdWp25dgkve2amgzd0nkbiTctB0KnmHiylwBbiDnKXtJHz7TKj2W ny//RRUkyh+N6ZDPlIZueX2g7DMxdjdWXzsQARST1vj06sRognd/Lw7Zh5xyFer4y4 cLd/BVibYLfP+c7sTDDDgyqDnlBWqV+EhHomdGxUiSDTBGigFjtTsb0YVpH/3IgSS1 IcP13EfhFtoBQHQbf+UHLLwB7RTRp/LX/noHS7lUCmYhEiLQzRMcBw2CsiJuNcHU6J snvKQkKtTLeALK7MBiFuPmnE2LZKom0j0nzy21IfCP+QpHHR7h6jkrvuMKpkS4Yb59 a4j1duHzWlawg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id EA7DE9B; Wed, 16 Oct 2024 11:22:48 +0200 (CEST) Date: Wed, 16 Oct 2024 11:22:48 +0200 From: Alvaro Herrera To: drh@sqlite.org, pgsql-docs@lists.postgresql.org Subject: Re: CLUSTER command Message-ID: <202410160922.cahfnhjlhawv@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <172898828398.700.17746720152307042879@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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