Re: Upgrading 6 versions between 2 systems

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Upgrading 6 versions between 2 systems
Date: 2026-09-14 20:43:03
Message-ID: CANzqJaBQYcLc=aThm52En4EY+sPvQy6gTLx+ekiA4wuJjMJFKw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Sep 14, 2026 at 4:26 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:

> When I've upgraded postgres in the past on my server/workstation it's
> usually been from one major version to the next. What I want to do now is
> to
> move from 12.7 (on an older OS linux version) to 18.6 (on the current
> version.)
>
> I know that data formats can change with postgres version increases so my
> question is: can I use dumpall in the 12.7 version and move that to the
> host
> running 18.6 since the output is a text .sql file?
>

Yes. Note, though, that a single .sql file is the *slow* way to
export/import a database, especially if it's of any size.

Multithreaded export import is faster. Something like this is what I'd do:

Current system:
cd /path/to/backups
pg_dumpall --globals-only > globals_127.sql
Zlvl="--compress=zstd"
Threads=4 # or whatever
for db in x, y, z; do
pg_dump -p5432 -Fd $Zlvl -v --jobs=$Threads -f $db $db
done

New system:
cd /path/to/backups
psql -af globals_127.sql
Zlvl="--compress=zstd"
Threads=4 # or whatever
for db in x, y, z; do
${pg18}/pg_restore -p5433 -v --jobs=$Threads --clean --create -Fd -d
postgres $db
done

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2026-09-14 20:43:20 Re: Upgrading 6 versions between 2 systems
Previous Message Merlin Moncure 2026-09-14 20:30:46 Re: introducing pgasync and pgflow