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 1uY8Zb-001fVP-Cu for pgsql-general@arkaria.postgresql.org; Sat, 05 Jul 2025 19:29:19 +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 1uY8ZZ-009Y9v-Fa for pgsql-general@arkaria.postgresql.org; Sat, 05 Jul 2025 19:29:18 +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 1uY8ZY-009Y9n-VN for pgsql-general@lists.postgresql.org; Sat, 05 Jul 2025 19:29:17 +0000 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uY8ZX-005l5i-2H for pgsql-general@lists.postgresql.org; Sat, 05 Jul 2025 19:29:16 +0000 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-40a55314d06so650751b6e.1 for ; Sat, 05 Jul 2025 12:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751743755; x=1752348555; 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=LsdlIT40mLZnKVRCznIhrUMwqxeNdvXEos/ptFDPGSE=; b=O09hnO/PacGoOcTKvgwvtkEhZjdU3R0oNMN7SriaQjsFxaGVaG/zlu1TT8WQhHb5t9 qrxPS47HydFKiLEVCFAW+zKZf3QH9+vpuNivXaVRqMxWfUPhTy/RNAUCnZEer4Vz3G/b 9pWUnQrZhh6B0M8OUFxhvSu8dd4Kx0loTGLBSRiNFJre4/Mn9j0WxXDkTtE0AAqYvaJs FeF2g2msHIWtTXLt3QHDkPlRqR3uDHe0zJkJIHE50GPg5vjONmVBU4hzQXGo4v4feYFi 9iB5ZvaB6cXASBwW+5ujd3s7xBV0Qbitlktn2ZTpeSWG86gWT0iAOckvelBewg9Ntim8 BTSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751743755; x=1752348555; 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=LsdlIT40mLZnKVRCznIhrUMwqxeNdvXEos/ptFDPGSE=; b=aoSOFLg9E5JUPVdtSt1U1I7b92bNQZDLLSeaGd8mW//xuTAjNPDAc2i91sjidE6TxC 5K9rI6GOsCG9+QOFXD4g4n7b3ry3yDqtFGv29BKeDIEfT2kUA3iGGPOiUOdSApBjuvMt Vsz5JV+FVRVlf1TWRSnz+YMnSR4DuYQPSezj3F951IfZQvyTfhvlIUtiqCIvbcPJkhfQ QzapAGken25hnTQ9TOjSIfWLCp/Y7y0xC1mQ8C0MAFBc1YNCPweR1MrebYMWxNTptC3X MRnnxRGqV/ZsxItcJQFM2okUPG+nYwB2JHA7fvwDL3OIxxLwjiF5knBVn/rEfUoxzQw8 ZlHA== X-Gm-Message-State: AOJu0YxpJkIJOAXCO6I21qBKg3GZRkae4vrIR/rRAmPblZHjDMG0ma+3 +rHBJctXffCpwdoDLuFNaB3LnqqsSeF5zrC5MdSzqat55vHSKnWwU2LRLn3SaJHABHrYqNCxeZH vKZv1fDmj8NSbqaSvbTn2umoe0OSLR0VyRxp+ X-Gm-Gg: ASbGncvMj0kBSLR/zND1nPvnXKGJt1bqCGbhIseX2f6VcMo2BMARXkOmErnhMUzlW4E 8v7sOyPFI1brpInHKEzYD2Gd4vyYPHYTxo1E7PQmIuaajytxjM9FxTigyoJPcQ0eXkuawH8fb0d fN43a86f+0KIFc3g0lb0pYx1dg2hvc8gKpdJUPuNaHROUq X-Google-Smtp-Source: AGHT+IEFgc+WDyscQs9DKcFAbEDRiFJDcbwMYgnxGZ/BpS0lH0hoeU9RBxIE2sYMEAow3J9HmYyDD+t7N0+lJIAuQH0= X-Received: by 2002:a05:6808:6716:b0:40b:441e:3603 with SMTP id 5614622812f47-40d2be51e50mr1886621b6e.14.1751743754712; Sat, 05 Jul 2025 12:29:14 -0700 (PDT) MIME-Version: 1.0 References: <20250705125207.31b4d475@pfortin.com> <20250705142416.06e99667@pfortin.com> <65041.1751740220@sss.pgh.pa.us> <20250705151928.3a9ea7b1@pfortin.com> In-Reply-To: <20250705151928.3a9ea7b1@pfortin.com> From: Ron Johnson Date: Sat, 5 Jul 2025 15:29:03 -0400 X-Gm-Features: Ac12FXyvx0SL4QKf3xRRZ3U2KszjS3Juqtqlb72GaZYLGnr9Xgk_gSFZzM7UgT4 Message-ID: Subject: Re: pg_upgrade: can I use same binary for old & new? To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000003cbc1d063933a0fb" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003cbc1d063933a0fb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Jul 5, 2025 at 3:19=E2=80=AFPM Pierre Fortin wrote= : > On Sat, 05 Jul 2025 14:30:20 -0400 Tom Lane wrote: > > Forgive my ignorance; always trying to learn more... :) > > >pf@pfortin.com writes: > >> On Sat, 5 Jul 2025 11:11:32 -0700 Adrian Klaver wrote: > >>> How did you measure above? > > > >> # du -sb /var/lib/pgsql/data > >> 8227910662297 /var/lib/pgsql/data > > > >It's likely that there's a deal of bloat in that. Even if there's not > >much bloat, this number will include indexes and WAL data that don't > >appear in pg_dump output. > > Does this imply that on restore, I'll have to re-index everything? > > >>> What was the pg_dump command? > > > >> Didn't try given: > >> $ df /mnt/db > >> Filesystem Size Used Avail Use% Mounted on > >> /dev/sdh1 17T 13T 3.0T 82% /mnt/db > > > >I'd say give it a try; be sure to use one of the pg_dump modes > >that compress the data. > > OK... I failed to mention I have several databases in this cluster; so > digging into pg_dumpall, I see: > --binary-upgrade > This option is for use by in-place upgrade utilities. Its use for > other purposes is not recommended or supported. The behavior of the > option may change in future releases without notice. > > pg_upgrade has --link option; but I'm puzzled by this option in a > dumpall/restore process. It's _not_ part of a dumpall/restore process. You _either_ run - pg_upgrade --link OR - pg_dumpall --globals-only > globals.sql / psql -f globals.sql - pg_dump --format=3Ddirectory / pg_restore --format=3Ddirectory of db1 - pg_dump --format=3Ddirectory / pg_restore --format=3Ddirectory of db2 - pg_dump --format=3Ddirectory / pg_restore --format=3Ddirectory of db3 - pg_dump --format=3Ddirectory / pg_restore --format=3Ddirectory of etc... Why not a plain pg_dumpall of the whole instance? Because that would create a GINORMOUS text file which can only be loaded in a single-threaded manner. > My imagination wonders if this alludes to a way > to do something like: > pg_dumpall --globals-only --roles-only --schema-only ... > Would restoring this be a way to update only the control structures? Big > assumption that the actual data remains untouched... > > Inquiring mind... :) > > Back to my upgrade issue... > All my DBs are static (only queries once loaded). Assuming the dumpall > file fits on one of my drives: > pg_dumpall -f /PG.backup -v > appears to be all I need? pg_dump has compression by default; but I don't > see compression with dumpall other than for TOAST. > > Thanks, You guys are awesome! > > > regards, tom lane > > > --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --0000000000003cbc1d063933a0fb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Jul 5, 2025 at 3:19=E2=80=AFPM Pi= erre Fortin <pf@pfortin.com> wr= ote:
On Sat, 05 Jul 2025 14:30:20 -0400 Tom La= ne wrote:

Forgive my ignorance; always trying to learn more... :)

>pf@pfortin.com = writes:
>> On Sat, 5 Jul 2025 11:11:32 -0700 Adrian Klaver wrote:=C2=A0
>>> How did you measure above?=C2=A0
>
>> # du -sb /var/lib/pgsql/data
>> 8227910662297=C2=A0 =C2=A0/var/lib/pgsql/data=C2=A0
>
>It's likely that there's a deal of bloat in that.=C2=A0 Even if= there's not
>much bloat, this number will include indexes and WAL data that don'= t
>appear in pg_dump output.

Does this imply that on restore, I'll have to re-index everything?

>>> What was the pg_dump command?=C2=A0
>
>> Didn't try given:
>> $ df /mnt/db
>> Filesystem=C2=A0 =C2=A0 =C2=A0 Size=C2=A0 Used Avail Use% Mounted = on
>> /dev/sdh1=C2=A0 =C2=A0 =C2=A0 =C2=A0 17T=C2=A0 =C2=A013T=C2=A0 3.0= T=C2=A0 82% /mnt/db=C2=A0
>
>I'd say give it a try; be sure to use one of the pg_dump modes
>that compress the data.

OK...=C2=A0 I failed to mention I have several databases in this cluster; s= o
digging into pg_dumpall, I see:
=C2=A0 =C2=A0--binary-upgrade
=C2=A0 =C2=A0 This option is for use by in-place upgrade utilities. Its use= for
=C2=A0 =C2=A0 other purposes is not recommended or supported. The behavior = of the
=C2=A0 =C2=A0 option may change in future releases without notice.

pg_upgrade has --link option; but I'm puzzled by this option in a
dumpall/restore process.

It's _not_ par= t of a dumpall/restore process.

You _either_ run
- pg_upgrade --link
=C2=A0 OR
- pg_dumpall --g= lobals-only > globals.sql / psql -f globals.sql
- pg_dump= --format=3Ddirectory / pg_restore=C2=A0--format=3Ddirectory=C2=A0of db1
- pg_dump --format=3Ddirectory / pg_restore=C2=A0--format=3Ddi= rectory=C2=A0of db2
- pg_dump --format=3Ddirectory / pg_rest= ore=C2=A0--format=3Ddirectory=C2=A0of db3
- pg_dump --= format=3Ddirectory / pg_restore=C2=A0--format=3Ddirectory=C2=A0of etc...

Why not a plain pg_dumpall of the = whole instance?=C2=A0 Because that would create a GINORMOUS text file which= can only be loaded in a single-threaded manner.=C2=A0
=C2=A0
My imagination wonders= if this alludes to a way
to do something like:
=C2=A0pg_dumpall --globals-only --roles-only --schema-only ...
Would restoring this be a way to update only the control structures? Big assumption that the actual data remains untouched...

Inquiring mind...=C2=A0 :)

Back to my upgrade issue...=C2=A0
All my DBs are static (only queries once loaded). Assuming the dumpall
file fits on one of my drives:
=C2=A0pg_dumpall -f <path>/PG.backup -v
appears to be all I need? pg_dump has compression by default; but I don'= ;t
see compression with dumpall other than for TOAST.

Thanks, You guys are awesome!

>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0regards, tom lane




--
Death to <Redacted>, and butter sauce.Don't boil me, I'm still alive.
<Redacted> lobs= ter!
--0000000000003cbc1d063933a0fb--