Re: PostgreSQL Upgrade (v9.5 to v12) with Django 2.0

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: PostgreSQL Upgrade (v9.5 to v12) with Django 2.0
Date: 2025-06-12 13:18:52
Message-ID: CANzqJaAbdgpP_kZznpvfmf62bofZ_wCRn05BvhgFx=Y5f4N6iA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, Jun 12, 2025 at 7:30 AM Kushal Shri <shrikushalk(at)gmail(dot)com> wrote:

> Dear Community,
>
> We are in the process of planning a PostgreSQL upgrade and would greatly
> appreciate any insights, best practices, or lessons learned from your
> experiences.
>
> Current Setup:
> - PostgreSQL version: 9.5
> - Django version: 2.0
> - Database size: ~3 TB
> - One Master 4 Replicas(Streaming Replication)
>
> We are taking a phased approach to this upgrade. In Phase 1, our goal is
> to upgrade PostgreSQL from v9.5 to v12, ensuring compatibility with our
> current Django 2.0 application.
>
> As part of this, I would like to understand:
>
> - What is the highest PostgreSQL version reliably supported with Django
> 2.0?
> - What upgrade strategies or methods have worked well for you in similar
> environments?
> - Any gotchas or performance considerations to keep in mind with large
> databases during such upgrades?
>
> Your recommendations and experiences will be extremely valuable in helping
> us plan and execute this upgrade smoothly.
>

If you have (or can add) 3-4TB on your existing server, then pg_upgrade to
12.22 is possible. (You can also do a hard-links pg_upgrade, but there's
no going back once you start the instance with v12. That's why I like
upgrading to a new disk.) A 3TB instance should take no more than a few
hours (depending on disk and controller speed.)

From there, you can (eventually) use logical replication from v12 to your
new server running PG17 (which I suggest, since it's the latest, and you
run servers for a long time).

One notable issue with pg_upgrade is extensions. It _can_ be as easy as
ALTER EXTENSION <extension> UPDATE but if there are dependencies, you might
have to DROP EXTENSION <extension> CASCADE and then run the DDL to recreate
the dependencies. Tha' can get messy if the end of the dependency chain is
a table. Only you know for sure.

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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2025-06-12 13:19:37 Re: PostgreSQL Upgrade (v9.5 to v12) with Django 2.0
Previous Message Ron Johnson 2025-06-11 15:39:29 pg_upgrade --copy-file-range recommendations?