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.96) (envelope-from ) id 1vJzlp-00BFIS-0I for pgsql-admin@arkaria.postgresql.org; Fri, 14 Nov 2025 19:47:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vJzlm-007rnf-2m for pgsql-admin@arkaria.postgresql.org; Fri, 14 Nov 2025 19:47:42 +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.96) (envelope-from ) id 1vJzlm-007rnV-1f for pgsql-admin@lists.postgresql.org; Fri, 14 Nov 2025 19:47:42 +0000 Received: from mail-oa1-x34.google.com ([2001:4860:4864:20::34]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vJzlk-007lwP-1j for pgsql-admin@lists.postgresql.org; Fri, 14 Nov 2025 19:47:42 +0000 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-30cce892b7dso1140550fac.1 for ; Fri, 14 Nov 2025 11:47:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763149658; x=1763754458; darn=lists.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=+WOzU/zhb/Ka4tf/MfyJ/Z2L5liB4jvLD+fXIogyex0=; b=JY12tPbNenDWyiVqdR7rdAA8ZGHsEe+IqyCXo27qslZToGe4ufDW1duSm23TVT/1pX //TwQBuGeLjPh9N24Jzm9v8Xlep5QTrdZO7sayfIkSwpcXue52cWUHIRxHBbJJBoFyqB O8IO7IQxGfOmGvB+plY1mJw7sjb/FRPz/JT32Wtlj2qdt2AO9RrMLfFEkILBPKqECflH G2Fe97pZxYvo8QYa4q3XJot7p9YTpXnDHr8bDuGDh75kVgGDQX+V0T0RgTBsPzdOxdos udJlgYNdQtZAdI6KVxmTY9UruJqduU90+vFYWAGid4QyH/PMhmSu6htT1qqVxoo04A1K XTLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763149658; x=1763754458; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+WOzU/zhb/Ka4tf/MfyJ/Z2L5liB4jvLD+fXIogyex0=; b=wsdiQhVff27UaS/myHDHzt6dCvIUZpDy1TNmV3BfeIEdU8uDroiz8jtQntvYF8gIqR ZMgEDysR3QkhAJ0spqhVuqCeqysRWdv1ALh1yKBATTnVAWCioqNlvYcZoYqt4W+Sm1G9 BYtUjuuTBjQtWLO+wc4tVbOyBxxOYH1v8A9lmBS8DtDwez7zq8z6Glj4F7g1nEKTW/MJ oOA/H6cP0bkETyf+dqtK6+Ym3O7qj3LAO+0Oqj+AenYS4J8aC8bCuQ7GcEomhDpN9T8b KuKJzK6sbSi6ejKolh7WPcL8a8Yc1o6ga0pjdVHjM/gew4Wz2/ccmZDZfNTAmT0Ae4Ur AiOA== X-Gm-Message-State: AOJu0YxXVIiajBzxdVHZtM/jb6lkKa4xpo9t/pkQ3aC7POB5zSForZ+Y jVK6pts1X9wwWQS0pbrF+dYxCadcHylIlex+mI8inZOZCh507KHh8pUZcHHs1cMw2B18X7qij1/ UsB6uULaCbi76aGO0lcVyDjS5B0KNAc4n5Jlm X-Gm-Gg: ASbGncto/hAso3DH8AnFzY8bT2bvJBjxuarnzFnHK4YCeJ/IRxYZJHz+kYfoFtyKYJq I9NPYRcr0ClVjlSHRQ8IGkr8+zHmrigZqfPXPZ/fxta9GAMTeRQDE+NilSpd6Kb8phuwfGGQR+O 78wjqdursmG9thFAY3smixS8U08bX0wNTV1zq+7VrT+/SoY/0HX/xNJaJT9lNK3VzJBHo/DuIL1 Rx8gcU04wzFcWzCcho4SwODZC4S7sSTbJy0c9CYr0QokjJMJwklHyniINZl13rHb1oU3QIV X-Google-Smtp-Source: AGHT+IGJDAo6YGaGy6uYUm5eDGKgbZyNCLiiLJ8942KG4uG9KGmvnFy2RmdBAmx6M/JZXr2IIR+Ho4VGnRerEq5Xx3g= X-Received: by 2002:a05:6870:e996:b0:399:58c2:2e5b with SMTP id 586e51a60fabf-3e86918a45fmr2418372fac.51.1763149658096; Fri, 14 Nov 2025 11:47:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Fri, 14 Nov 2025 14:47:27 -0500 X-Gm-Features: AWmQ_blcuIUoZPQIEMOzr_l8zuERFxw1HTLpTovGekDu-3bYnXZ2yz1PdLYlOh0 Message-ID: Subject: Re: rebuild big tables with pgrepack To: Pgsql-admin Content-Type: multipart/alternative; boundary="0000000000000e883a06439345a1" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000e883a06439345a1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Nov 14, 2025 at 2:14=E2=80=AFPM ek ek wrote= : > Hello everyone, > I=E2=80=99m going to rebuild a 900GB table using pg_repack. I=E2=80=99m h= esitant to do > such a large operation in one go. > Is there an ideal or recommended way to repack very large tables? > Everything in database maintenance is circumstantial. The basics that I'd do are: * Verify that you have enough free disk space for both the new table, the new indices and also the WALs generated. * Do it during a low-activity window. * Don't run a database backup at the same time. * First execute with --dry-run. * Consider the --no-order option. That'll speed things up. * And --no-analyze, though you'll have to manually ANALYZE immediately afterwards. * (I'd probably disable autoanalyze on that table before the repack and then enable it after the manual ANALYZE.) * The --jobs option speeds up index rebuilds. * Run it from cron, and redirect both stdout and stderr to the same log file. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --0000000000000e883a06439345a1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Nov 14, 2025 at 2:14=E2=80=AFPM e= k ek <livadidrive@gmail.com= > wrote:
Hello everyone,
I=E2=80=99m going to rebuild a 900= GB table using pg_repack. I=E2=80=99m hesitant to do such a large operation= in one go.
Is there an ideal or recommended way to = repack very large tables?

Every= thing in database=C2=A0maintenance=C2=A0is circumstantial.

The basics that I'd do are:
* Verify that you have e= nough free disk space for both the new table, the new indices and also the = WALs generated.
* Do it during a low-activity window.
*= Don't run a database backup at the same time.
* First execut= e with=C2=A0--dry-run.
* Consider the=C2=A0--no-order option.=C2= =A0 That'll speed things up.
* And --no-analyze, though you&#= 39;ll have to manually ANALYZE immediately afterwards.
* (I'd= probably disable autoanalyze=C2=A0on that table before the repack and then= enable it after the manual ANALYZE.)
* The --jobs option speeds = up index rebuilds.
* Run it from cron, and redirect both stdout a= nd stderr to the same log file.

--
Death to <Redacted>, and butter sauce.
Don&#= 39;t boil me, I'm still alive.
<Redacted> lobster!
--0000000000000e883a06439345a1--