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 1rywXx-001BkA-AE for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 16:29:37 +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 1rywXv-008PZN-U8 for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 16:29:35 +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 1rywXv-008PZ4-Ir for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2024 16:29:35 +0000 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rywXt-002Muv-AE for pgsql-general@postgresql.org; Mon, 22 Apr 2024 16:29:34 +0000 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-5aa1e9527d1so3810570eaf.1 for ; Mon, 22 Apr 2024 09:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713803371; x=1714408171; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=naEcxrrPL1QSKZd3jn1YleKaJ5dvoqlKbKZWHBk3iG8=; b=BaO5/Q0tNb7tMu9ugPcr3NCBy9Cp7NM9MORz04fgfcZlBA9iVzawhyohdstIGtl11U pkzgMxuQHUwHZAiW+ApvD+kLlm8JLG8vUsg+TVeeDwoAOJBjub+btH49r0aIb3wiNezv YVy6pCOj+0TuhztaxSDIDjIEwo5OYVH8E1fge2p/WTJGHJ58eg2BMp/i10ns7p7joQMB i2txi4eZrf7Hnes0fyFJexi1i9QzkQNDYOZWevv1rStLXP0wFyfk2ieyuINIeI7roUx5 /I3sBpLiO66sj/9LvbJy0Ok4n6G24fa3sYKBnfvcfKb+G4qqaLQ1OXqoepb8dYOjQLf0 HI2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713803371; x=1714408171; h=cc: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=naEcxrrPL1QSKZd3jn1YleKaJ5dvoqlKbKZWHBk3iG8=; b=HQuqgm32vrbfvx4sztxtusfhxvTFVvCbZ7fqM+/yODAyO+Qr4MFYgG1S/C3Rd3euZi hsBW5Pav47Bi0hQvSRBNthxC62ZUTzx8Qb4QSraVdbFFSDPVWSrNZDI2crwW+a9gpQM8 49jQA2l6po32NaAzWYNfczegGSD5p0fJ3X73biiJ6w8vfT8THzRIMDMIzqyFpaB81Nkn gZUquwTfrqN7Sr6IgheaSNcGeoKntKco3bVx4guv1HIYJGXZP1JLk+lBnMFqPtyX9jSf z6bxtFCHsdV1/woCDelZD+4v/usKoIFzHW59910eWKSey7clwm7XrQ91L3kevEPEyaZT mBnQ== X-Gm-Message-State: AOJu0YyAtX2tpkMlS0VjWrCob0nr9iGM4pZQDWjtbZ9cNJvnsW6yjuly bBdzCXmuscQsUyLRKejdEDwusGz4EJR8wPxyMzS+uGLKk8JL7A0mU1qyYzmOqVkK4QHvmmj1Qma bb6FJkfNhzKEc/ZvzVXWvTMsr0D8= X-Google-Smtp-Source: AGHT+IEiuYpy0I4SecrRFrDG0tITdSiJj8V9XDqT6XwFJo9dEQYbLDMITdscF2LmlSWENTSjCgPNkn/brTOwQe0NGg0= X-Received: by 2002:a4a:a9c3:0:b0:5a4:75f2:54d0 with SMTP id h3-20020a4aa9c3000000b005a475f254d0mr10598857oon.9.1713803371138; Mon, 22 Apr 2024 09:29:31 -0700 (PDT) MIME-Version: 1.0 References: <2870091.1713739514@sss.pgh.pa.us> <3043219.1713795953@sss.pgh.pa.us> In-Reply-To: From: "David G. Johnston" Date: Mon, 22 Apr 2024 09:29:21 -0700 Message-ID: Subject: Re: CLUSTER vs. VACUUM FULL To: Ron Johnson Cc: pgsql-general Content-Type: multipart/alternative; boundary="00000000000026d6920616b1f1a0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000026d6920616b1f1a0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 22, 2024, 08:37 Ron Johnson wrote: > On Mon, Apr 22, 2024 at 10:25=E2=80=AFAM Tom Lane wro= te: > >> 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 timesta= mp > or something else that grows monotonically). > > That's because the data is already roughly in PK order. > If things are bad enough to require a vacuum full that doesn't seem like a good assumption. Any insert-only table or one with a reduced fill-factor maybe. David J --00000000000026d6920616b1f1a0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, Apr 22, 2024, 08:37 Ron Johnson <ronljohnsonjr@gmail.com> wrote:
=
On M= on, Apr 22, 2024 at 10:25=E2=80=AFAM Tom Lane <tgl@sss.pgh.pa.us> = wrote:
Marcos Pegoraro <marcos@f10.com.br> writes:
> But wouldn't it be good that VACUUM FULL uses that index defined b= y
> Cluster, if it exists ?

No ... what would be the difference then?
=C2=A0
=
What the VACUUM docs "should" do, it seems, is suggest CLUST= ER on the PK, if the PK is a sequence (whether that be an actual sequence, = or a timestamp or something else that grows monotonically).

<= /div>
That's because the data is already roughly in PK order.
=

If things are bad enough to require a vacuum full that d= oesn't seem like a good assumption.=C2=A0 Any insert-only table or one = with a reduced fill-factor maybe.

David J=C2=A0
--00000000000026d6920616b1f1a0--