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 1ryvxS-0019Qw-SZ for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 15:51:55 +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 1ryvxQ-0076TH-Am for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 15:51:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryvxP-0076T1-AV for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2024 15:51:51 +0000 Received: from wfhigh7-smtp.messagingengine.com ([64.147.123.158]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryvxI-002MeK-7d for pgsql-general@postgresql.org; Mon, 22 Apr 2024 15:51:50 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.west.internal (Postfix) with ESMTP id 138EE1800101; Mon, 22 Apr 2024 11:51:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 22 Apr 2024 11:51:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1713801100; x=1713887500; bh=4vd/2HL2fwcTq0I0XkORcRBp1kLw9HhrE8LGIldyntA=; b= qqvvo4HOpyT7BWDktq/xIs4jZXWxXP0qldcdG7f2Vj7FH9PZAYDW/f19O+Fc0NiD 7QzvFpTmsc58mcbanIrZzuS219HF6667+2tnBxyCHXWE7YI6veXSInE1YnmyuDWl Luzs/ssQRKUPRUQu8Gpvw5Vs5zyM8EN/6zRcQFhn4ZRH2B3JqLP61CvmONlQwXhJ xNpZdR+tMAdfrAxC6qltVLjhtqNLErzxLPfiXxSiQ5VYZLh9SYd6ieSPXBzY/oob 8KMKgXMGL7o/o/2uUYXQrn0PjaY9S4Qi6Qr7ZOxUC2tdWRPwGQvuAaJ0qggKNzr0 DrnG6you99sVNg1pv4TK0Q== 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:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1713801100; x= 1713887500; bh=4vd/2HL2fwcTq0I0XkORcRBp1kLw9HhrE8LGIldyntA=; b=T ako8hZPgfxuvqtJ9/71XIGxYVGzhozqPXWP7wgc6TErjeYs+tjE2Scd3cTHiwLfq 2P5++i5Tx5+bxDQOxvvnGwA+NGepEiXdnWA2Stgwqcef0n0wcf0ptxlyv+FiNvPV 2uypdCYwpCNFqlT/p2137zTpHloDtq2GPefoLzNIFV6+cRicm/N0rbnXL8ryMEAu L66ln+qshu2ikT2UND4L8yENI26sPZtsRMn4FnGcjdoDvXDh5UCptfwCCZijSZgO 0KzspJdSpzt6wp42j6CrkkqRK1pJ3OK+CFBtF3a6tbNiY229PD9+Pkkx1lwCe8sP 6lhMlNtRxD/FMidCnk0gg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudekledgleefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtke ertddtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepffelgeeife fgveduhedthfekuedtffejveegffegjeevtdehgfduieetfeehjeehnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 22 Apr 2024 11:51:39 -0400 (EDT) Message-ID: <824158e3-58ac-42ec-b77e-60d19564284a@aklaver.com> Date: Mon, 22 Apr 2024 08:51:38 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: CLUSTER vs. VACUUM FULL To: Ron Johnson , pgsql-general References: <2870091.1713739514@sss.pgh.pa.us> <3043219.1713795953@sss.pgh.pa.us> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/22/24 08:37, Ron Johnson wrote: > On Mon, Apr 22, 2024 at 10:25 AM Tom Lane > wrote: > > Marcos Pegoraro > writes: > > But wouldn't it be good that VACUUM FULL uses that index defined by > > Cluster, if it exists ? > > No ... what would be the difference then? > > What the VACUUM docs "should" do, it seems, is suggest CLUSTER on the > PK, if the PK is a sequence (whether that be an actual sequence, or a > timestamp or something else that grows monotonically). Why? That would, per David Rowley's comments, impose a sort cost on top of the cost of hitting every heap page and rewriting it. You end up with sorted table granted, until such time as you start making changes to it. If you are to the point of running VACUUM FULL that indicates to me the table has seen a heavy load of changes that you want to clean out. Given the temporary nature of the effects of a CLUSTER under a change load I don't see why it would be the way to go to clean up a changing table. > > That's because the data is already roughly in PK order. > -- Adrian Klaver adrian.klaver@aklaver.com