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 1ryhDJ-0000WQ-3H for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 00:07:17 +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 1ryhDF-00GZCF-HL for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 00:07:13 +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 1ryhDF-00GZC3-3l for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2024 00:07:13 +0000 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ryhD8-002FM6-Gy for pgsql-general@postgresql.org; Mon, 22 Apr 2024 00:07:12 +0000 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-5aa4a1246b1so2272804eaf.3 for ; Sun, 21 Apr 2024 17:07:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713744424; x=1714349224; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=2qRy/EIF1CEZlbEBaDsTSu7eJ8t+5BO8+frDdLyRTHA=; b=HlM7jHEomK2nI3W8b38rhClzryHYPaw6KTY5G7mihhdBq3jFPX4OAJMttAg2gSezbr okTfMPGRbL7t0BqrUEm7bRluuE6c6rX0zJ7LNHerSOCifsn0pAkQn4iN3MVDUdVPB4MY MwGwqubHjzBSrbRqxLSIEMdmSM63iT8u9okX878jaMpdppDSRA14PSp0uRfBodiSnKLo zcvsq2oLLsqRPTWBNcvI7jXwz1AuzNFIzcze+be0i/Fgo7MID0BJt+xDwXBpNKXR52Id jLby6SIm3TfbN94KlvJjf5hrqW+j+/QGvMx/IRsXg+KzOYOe07H3j+vRVGV+Ejwz1Sz2 YKmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713744424; x=1714349224; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2qRy/EIF1CEZlbEBaDsTSu7eJ8t+5BO8+frDdLyRTHA=; b=XaVjGYUXAbcmPhyjXzmj+AQcKDhGSTDZhu9N6SVBhYAOrqiP+0xCggV2bUub+f1HDU V1rj+6YBtvi983SLJnlxSStxwPB1VLRGjbX7rsBARCIB6SYz0c7U7OOYUMELUlRIzNu0 Mf/OFWUgiTJURODjJ3/T2cUxK40B1W2v0uOP+j87d/U7mPEccof1GRiOlfm8Q5PLr/XW En2MGmlCIRmAYu+EUjc+g6Bu1HFXnyCeAluM9ChTzDo4j8BZHqHXsaExgZazxD4uUT1l JLuDsO4t7Qe1eqSIh83IgbcIHXuODpOqXKY27cgUfQcYzKqJqWpWBAnYWrk0cp9CUYVI FuPA== X-Gm-Message-State: AOJu0YzPEhZLzb+pMvK5snWg0UWN4JKRfnlpH1+S1IJrwLqjlPY/mxqU N1my00rLVdFH/nSvomWCNmVIsvfXx69j5TYeziYn5Dv7uJFPntZgKkp+fd75PMkq+7INaKaar8Y 43UfKkHE8k5MQ4oMb9dH7Z8sBCpp19g== X-Google-Smtp-Source: AGHT+IH2pjqUEzoknrAudc6erBh1yQejWu1SyWsmZ6xaAQblGmgrtKEHiLHulabddLJu5ujy6+kvf0CreHJFTBT9cLA= X-Received: by 2002:a05:6871:e408:b0:22e:7390:da7 with SMTP id py8-20020a056871e40800b0022e73900da7mr10787661oac.21.1713744423875; Sun, 21 Apr 2024 17:07:03 -0700 (PDT) MIME-Version: 1.0 References: <2870091.1713739514@sss.pgh.pa.us> In-Reply-To: <2870091.1713739514@sss.pgh.pa.us> From: Ron Johnson Date: Sun, 21 Apr 2024 20:06:52 -0400 Message-ID: Subject: Re: CLUSTER vs. VACUUM FULL To: pgsql-general Content-Type: multipart/alternative; boundary="0000000000009f012c0616a437f0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000009f012c0616a437f0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Apr 21, 2024 at 6:45=E2=80=AFPM Tom Lane wrote: > Ron Johnson writes: > > Why is VACUUM FULL recommended for compressing a table, when CLUSTER do= es > > the same thing (similarly doubling disk space), and apparently runs jus= t > as > > fast? > > CLUSTER makes the additional effort to sort the data per the ordering > of the specified index. I'm surprised that's not noticeable in your > test case. > It's in a freshly restored database. However, regular deletions of old records, and normal vacuums would have led me to expect that the "fresh" public.log would have been in relatively random order. --0000000000009f012c0616a437f0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Apr 21, 2024 at 6:45=E2=80=AFPM T= om Lane <tgl@sss.pgh.pa.us> = wrote:
Ron Johnson <ronljohnsonjr@gmail.com> writes:
> Why is VACUUM FULL recommended for compressing a table, when CLUSTER d= oes
> the same thing (similarly doubling disk space), and apparently runs ju= st as
> fast?

CLUSTER makes the additional effort to sort the data per the ordering
of the specified index.=C2=A0 I'm surprised that's not noticeable i= n your
test case.

It's in a freshly restor= ed database.=C2=A0 However, regular deletions of old records, and normal=C2= =A0vacuums would have led me to expect that the "fresh" public.lo= g would have been in relatively random order.

--0000000000009f012c0616a437f0--