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 1tJGmj-001rVP-IM for pgsql-sql@arkaria.postgresql.org; Thu, 05 Dec 2024 18:41:09 +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 1tJGmg-008A8n-HL for pgsql-sql@arkaria.postgresql.org; Thu, 05 Dec 2024 18:41:07 +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.94.2) (envelope-from ) id 1tJGmg-008A8f-6M for pgsql-sql@lists.postgresql.org; Thu, 05 Dec 2024 18:41:07 +0000 Received: from mail-lf1-f44.google.com ([209.85.167.44]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tJGmZ-001E5k-Qp for pgsql-sql@lists.postgresql.org; Thu, 05 Dec 2024 18:41:06 +0000 Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-53e224bbaccso1388167e87.3 for ; Thu, 05 Dec 2024 10:41:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733424059; x=1734028859; h=cc: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=u0vP2j5R7JPjQfr8tFQV5X0b4mhPdeC2NYW7QJdFVP0=; b=aD6hN9Ku4W/siYyA/FZnBA1kyPwRUg8m7CDwkx3+6cqzNXtBl4A3aI73ck/cME4C1+ +t7NuPeDgZGIZkhFqmQbupjlW9ycPhRtes0W7K73HLsFLkU1qjgzdOR2Pvok1EICdt49 fYJ/HgKm8XdAKXZBS09vBXK7URcHJZEA92O4HSpObmcwn2iTEbe7GPsoJ34lPqmhQrs1 4QfFhf50S+VMI+O7HYGjYSntD8m0TRluTpW8owQKoQ6iNpMMsMx4nU1pFkeGj4TzecL8 QpdV4euQVTYsGE1TfKfk9kphpl+MkGfpbyqZwZ1EntA6FjhRVJGA1gKNdRPXEM3muRfj 3YyA== X-Gm-Message-State: AOJu0YwsqRrZaQ6bWCzh7fQYPhK5y23spBVy3zyBXJn2oeb7Y6MSbhd8 8SW7I6V9a43DadTjFBtOn5j/GA5bSWOklyhxJPZ2Tf1/5hpx5nLPop2iHMOp X-Gm-Gg: ASbGncuru86J53GkwRNMLWudcRve//CKGQpA6/qtAOP5F6tQ7BwUWKgWJ4GDPEaA76l BHGNkdUcb7ZseDQuf0Srt+4Qd1oecgG0PLPVxMot1Q9zaCjDJe1UtzjCmUCKQ4aKwevKDSvyaeb ZTeZo8GzvMNikh7WyiGtbT2flogxm30WNMc7vXWbTeU9lTpD8KsIUgA8kQ7BzEhvs1pFdC/F1TT /v+iMY2PoM2J73+1jvUuLnNH2bnMJlJdWFJDPBeWR66RoubLXr1cGk7kUQU1S3gC6lYic1IXEI1 LzqWJVuY1Q== X-Google-Smtp-Source: AGHT+IG9Zrl5LzSLuwPLPBzpaLh4etkBCtXWqCk01AovcHE8JJmQaHm8gSiayumNhso2RTSd82lJZA== X-Received: by 2002:a05:6512:220c:b0:53e:1c53:b1e3 with SMTP id 2adb3069b0e04-53e2c2c25d9mr3936e87.34.1733424058595; Thu, 05 Dec 2024 10:40:58 -0800 (PST) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com. [209.85.221.49]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa6260e0389sm125901966b.174.2024.12.05.10.40.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Dec 2024 10:40:58 -0800 (PST) Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-385eed29d17so1056985f8f.0 for ; Thu, 05 Dec 2024 10:40:58 -0800 (PST) X-Received: by 2002:a5d:64e9:0:b0:385:df66:5eee with SMTP id ffacd0b85a97d-3862b35622amr126820f8f.16.1733424058148; Thu, 05 Dec 2024 10:40:58 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Steve Midgley Date: Thu, 5 Dec 2024 10:40:46 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Clarification Needed on PostgreSQL Version Upgrade To: Hamza Godil Cc: "pgsql-sql@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000003b375f06288a3d69" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003b375f06288a3d69 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Dec 5, 2024 at 8:33=E2=80=AFAM Hamza Godil = wrote: > Hello PostgreSQL Experts, > > > > I have a question regarding PostgreSQL versions and would appreciate some > clarification. We have two servers: > > > > - CCFMG-apps05 =E2=80=93 Windows Server 2019 > - CCFMG-VP =E2=80=93 Windows Server 2019 > > > > Both servers are currently running PostgreSQL version 14, while the lates= t > version available is 16.1. My question is: if we upgrade to the newest > version, will it cause any disruptions or errors in our work? Additionall= y, > should we change or copy the database before proceeding with the upgrade? > > > > Please let me know your recommendations. > > > The answers deeply depend on the nature of the systems and businesses that depend on these systems. Let's assume these databases are highly sensitive to downtime and data loss (aka "production" systems). Even then, can you have a "cut-over" downtime period of 5 min or an hour? Or what's the window? You'll need to answer questions like that. Let's assume you can take a comfortable 3 hour maintenance window to cut-over. First you have to validate that all the systems riding on top of Pg don't break when you upgrade. Can you do that in a staging environment? If so, set up a v16.1 staging system and run and test all your apps on that. As you're getting comfortable that the apps work, you're going to write some scripts that can dump, copy, and restore everything. Do that process over and over from prod to staging to prove you know how to do it reliably. Then prove you know how to rollback changes from the new system back to the old system (a reverse data load from 16 back to 14). Don't skip this step. You hope you never need it, but if you do need it, it is unhealthy to try to come up with a plan and tech in the moment. Make an easy way to redirect traffic from one set of servers to the other (14 to 16). Then set up a prod v16 server and wait for your window. Shut off all inbound activity Wait for all activity to settle down to zero Dump data from Pg 14 servers with your scripts Restore data to new Pg 16 servers with your scripts Verify closely that everything worked (no errors you aren't expecting) Redirect traffic to 16 Reopen inbound activity If all goes well, you're done. There are probably ways to simplify this, but if you are dealing with high value data, this is how I would think about it. Maybe you can get away with an "in-place upgrade" but I've been punished (not by Pg!) doing database upgrades in place and then stuff doesn't work and I can't go back to the old version. I hope this type of general input is helpful, Steve --0000000000003b375f06288a3d69 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Thu, Dec 5, = 2024 at 8:33=E2=80=AFAM Hamza Godil <HGodil@realtimeca.com> wrote:

Hello PostgreSQL Experts,

=C2=A0

I have a question regarding PostgreSQL versions and = would appreciate some clarification. We have two servers:

=C2=A0

  • CCFMG-apps05 =E2=80=93 Windows Server 2019
  • CCFMG= -VP =E2=80=93 Windows Server 2019

=C2=A0

Both servers are currently running PostgreSQL versio= n 14, while the latest version available is 16.1. My question is: if we upg= rade to the newest version, will it cause any disruptions or errors in our = work? Additionally, should we change or copy the database before proceeding with the upgrade?

=C2=A0

Please let me know your recommendations.

=C2=A0

The an= swers deeply depend on the nature of the systems and businesses that depend= on these systems. Let's assume these databases are highly sensitive to= downtime and data loss (aka "production" systems). Even then, ca= n you have a "cut-over" downtime period of 5 min or an hour? Or w= hat's the window? You'll need to answer questions like that.
<= div>
Let's assume you can take a comfortable 3 hour maint= enance window to cut-over.

First you have to valid= ate that all the systems riding on top of Pg don't break when you upgra= de. Can you do that in a staging environment? If so, set up a v16.1 staging= system and run and test all your apps on that.

As= you're getting comfortable that the apps work, you're going to wri= te some scripts that can dump, copy, and restore everything. Do that proces= s over and over from prod to staging to prove you know how to do it reliabl= y.=C2=A0

Then prove you know how to rollback chang= es from the new system back to the old system (a reverse data load from 16 = back to 14). Don't skip this step. You hope you never need it, but if y= ou do need it, it is unhealthy to try to come up with a plan and tech in th= e moment.

Make an easy way to redirect traffic fro= m one set of servers to the other (14 to 16).

=
Then set up a prod v16 server and wait for your window.=C2=A0
Shut off all inbound activity
Wait for all activity to se= ttle down to zero
Dump data from Pg 14 servers with your scripts<= /div>
Restore data to new Pg 16 servers with your scripts
Ver= ify closely that everything worked (no errors you aren't expecting)
=
Redirect traffic to 16
Reopen inbound activity

If all goes well, you're done. There are probably way= s to simplify this, but if you are dealing with high value data, this is ho= w I would think about it. Maybe you can get away with an "in-place upg= rade" but I've been punished (not by Pg!) doing database upgrades = in place and then stuff doesn't work and I can't go back to the old= version.

I hope this type of general input is hel= pful,
Steve

--0000000000003b375f06288a3d69--