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 1uY99z-001oN5-CV for pgsql-general@arkaria.postgresql.org; Sat, 05 Jul 2025 20:06: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 1uY99x-009oJZ-8Z for pgsql-general@arkaria.postgresql.org; Sat, 05 Jul 2025 20:06:53 +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 1uY99w-009oJM-Tu for pgsql-general@lists.postgresql.org; Sat, 05 Jul 2025 20:06:53 +0000 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uY99v-005lJJ-0R for pgsql-general@lists.postgresql.org; Sat, 05 Jul 2025 20:06:52 +0000 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 6EC69EC0204; Sat, 5 Jul 2025 16:06:50 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Sat, 05 Jul 2025 16:06:50 -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=fm1; t=1751746010; x=1751832410; bh=/gBfec70cnCKOES3VVMPvgRwIDyfaAI3tarvgToQ0PU=; b= LbqIJnGTf3YbmA5uVF4/w/bxV/Xr0kpbx3tqTjBJy1F/O3vUvrBSwqiOjOL+esZM l3pvJbYxflgIfaHh/xad38tZfinflKnrUBCi8HQetUu/Y42aqQsRQat3etuCWYmz eAw8rK3Zn3MJedG1Ube540tK0kiHzf86hS4bI5Dhu5MNcjPAmMGV/4qE6nosmTl3 TSSqvjU2kCQFPgdBBWQlkIqoWEq78naOzSJww34uL/CUe2klbxXlnVWjcM2h4y2b wd5fXv2aPaUl0gkMyZbYQgrqHJfruXt27HFIQjdtiO6Ny3OXBkjLPzQq3ZsjP6eG 0EQ9ArK2QwEJ5QL1dgUu9Q== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1751746010; x=1751832410; bh=/ gBfec70cnCKOES3VVMPvgRwIDyfaAI3tarvgToQ0PU=; b=gcHjLk5/coZu582k5 Kf9e7y0izaeZiomY5IKYHKzPrkSw66RyoiASNka6dRiK6yMRON/UuEfYv0cgik84 cjLLIxKv5l7EUr3MSHACVeI39EhdZoR0w421ONfQIb7HL6eslZb/BnCYpE/lHxgv GBCxJ/cK1OS/FehbL+YRDHN22CGB4cWsyFs4mqTjecic5+ORqfJdUBej1sSs+41Z xeR+Bv+HQbUJC2z4mPW8RhJ5KyxZyYYiQoVDats/wzs9EEnl3/p7N4021H+tN3Fa 9tzJzDgrUvfxCQ19ZqzmdlR71d0GmTEwo75ASlj5Qud+mOxfY2bfgXY8/PgQXSR3 T/qVQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvieelhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughrihgrnhcu mfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqne cuggftrfgrthhtvghrnhepleegveekkeekueeigfdtveeileeuhfefudefteekjeffkeej ueejheegheegkedtnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvg epshhmthhpohhuthdprhgtphhtthhopehpfhesphhfohhrthhinhdrtghomhdprhgtphht thhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdroh hrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 5 Jul 2025 16:06:49 -0400 (EDT) Message-ID: <0de4c4cb-7c54-4c4d-a50d-6ef6e005f724@aklaver.com> Date: Sat, 5 Jul 2025 13:06:49 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pg_upgrade: can I use same binary for old & new? To: Pierre Fortin , pgsql-general@lists.postgresql.org References: <20250705125207.31b4d475@pfortin.com> <20250705142416.06e99667@pfortin.com> <65041.1751740220@sss.pgh.pa.us> <20250705151928.3a9ea7b1@pfortin.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: <20250705151928.3a9ea7b1@pfortin.com> 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 7/5/25 12:19, 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? The dump file includes CREATE INDEX commands and per: https://www.postgresql.org/docs/current/sql-createindex.html "Creating an index can interfere with regular operation of a database. Normally PostgreSQL locks the table to be indexed against writes and performs the entire index build with a single scan of the table. Other transactions can still read the table, but if they try to insert, update, or delete rows in the table they will block until the index build is finished. This could have a severe effect if the system is a live production database. Very large tables can take many hours to be indexed, and even for smaller tables, an index build can lock out writers for periods that are unacceptably long for a production system." Which is why pg_restore: https://www.postgresql.org/docs/current/app-pgrestore.html has: "-j number-of-jobs --jobs=number-of-jobs Run the most time-consuming steps of pg_restore — those that load data, create indexes, or create constraints — concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server." > >>>> 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. 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 > > -- Adrian Klaver adrian.klaver@aklaver.com