Major Version Upgrade in Azure PostgreSQL Flexible Server – Public Preview

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

PostgreSQL is a powerful, open-source object-relational database system with over 35 years of active development that has earned it a powerful reputation for reliability, feature robustness, and performance.   PostgreSQL Global Development Group periodically releases new minor and major versions containing new features, performance improvements, and security enhancements. Azure Database for PostgreSQL Flexible server currently supports PostgreSQL versions 11, 12,13,14 and 15 (Coming soon) Postgres community releases a new major version about once a year and Flexible Server onboards recent version once they are released by the community. 

 

Azure-Postgres-TimeSeriesMerics1.png

 

Major Version Vs Minor Version 

 

The PostgreSQL version numbering system underwent a change starting with version 10. The first digit of the version number now represents a major version change, such as from 10 to 11. Meanwhile, the second digit signifies a minor version change, such as from 14.2 to 14.4. This change was made to provide a clearer and more predictable release schedule for database users. Minor version upgrades include changes that are backward-compatible with existing applications. Major version upgrades are more complicated as they can include breaking changes and new features that may not be backward-compatible with existing applications. Azure Database for PostgreSQL Flexible service updates the minor versions of the database during the customer's maintenance window, but major version upgrades require a separate process. Upgrading to a higher version of PostgreSQL often involves data migration, which can be a complex and time-consuming process that requires additional resources and results in business downtime. 

 

Starting today flexible server platform now offers an in-place major version upgrade feature, making it easier for customers to upgrade their servers to a higher version. This new feature eliminates the need for data migration, which traditionally involves setting up new servers and storage resulting in added costs, effort, and downtime. In-place upgrade process is faster, minimizes downtime, and keeps the existing server name and other settings intact, providing customers with greater ease in managing their infrastructure. Additionally, there is no need to change application connection strings, further simplifying the upgrade process for customers. 

 

In-Place Major Version Upgrade Benefits: 

 

  • Saves manual effort: The upgrade process eliminates the need for data migration, reducing the amount of manual effort required. 
  • Reduced cost: Since data migration is not required, customers can save on costs associated with provisioning new servers or storage. 
  • Shorter downtime: The upgrade process is not a size-of-data operation, resulting in shorter downtime for the business. 
  • No application changes required: The upgrade process retains the existing server name, eliminating the need for changes to the application connection strings. 

 

Process. 

In-place major version upgrade for Azure Database for PostgreSQL Flexible server can be initiated through either the portal or the CLI. Here is a high-level breakdown of this process: 

 

Pre-check: Before the upgrade begins, the flexible server performs a pre-check to identify any potential issues that might cause the upgrade to fail. If any incompatibilities are found, an error log is generated, and the upgrade is stopped. 

Backup: If the pre-check is successful, the flexible server stops the service and automatically takes a backup of the database. This backup can be used to restore the database instance to its previous version if there is an upgrade error. 

 

Run-Upgrade: The upgrade process is initiated using the pg_upgrade utility, which is designed specifically for upgrading PostgreSQL databases to a higher major version. Upon successful completion of the upgrade, the flexible server starts the service again, retaining the same server name but with an upgraded version of PostgreSQL. 

 

kabharati_0-1676294002251.png

 

 

 

 

How to Perform In-Place Major Version Upgrade: 

 

  1. You can perform in-place major version upgrade using Azure portal or CLI (command-line interface). Click the Upgrade button on the Overview blade. 

 

Upgrade.png

 

 

2. You'll see an option to select the major version of your choice, you have an option to skip versions to directly upgrade to higher versions. Choose the version and click Upgrade. 

        In the below screenshot I am skipping versions 12,13 and directly going from 11->14 

 

kabharati_2-1676294002255.png

 

 

  1. Once the upgrade is successful, you can expand the Deployment details tab and access Operation details to see more information about the upgrade process like duration, provisioning state etc. You can click on the Go to resource tab to validate your upgrade. You notice that server name remained unchanged and PostgreSQL version upgraded to desired higher version with the latest minor version. 

Postupgrade.png

 

 

 

 

 

 

 

 

You can also run the upgrade using Azure CLI using the command below. 

 

az postgres flexible-server upgrade -g resource_group -n server_name -v desired_pg_version 

 

 

Limitations: 

 

  1. During preview, major version upgrade currently does not support the following extensions Timescaledb, pgaudit, dblink, and postgres_fdw. 
  2. Upgrading the PostGIS extension is currently unsupported from PostgreSQL 12, while upgrading the orafce extension is unsupported from PostgreSQL 11. All other versions of these extensions are supported for in-place major version upgrade. 3
  3. Servers configured with logical replication slots are not supported.
  4. In-place major version upgrade currently does not support read replicas, so if you have a read replica enabled server, you need to delete the replica before performing the upgrade on the primary server. After the upgrade, you can recreate the replica. 
  5. In-place major version upgrade is currently unsupported for PgBouncer enabled servers. 

 

Most of the above limitations will be addressed in the coming weeks. 

 

 

Summary 

 
In this post, I explained the in-place major version upgrade process for Azure database for PostgreSQL flexible server and its benefits. To learn more about this feature including support for read replicas, extension and limitations please refer Major version upgrade documentation. 

 

I hope that this post provides you with a better understanding of in-place major version upgrade in Azure database for PostgreSQL and helps make your life as a database owner easier and more productive. We are always eager to get your feedback, please reach out via email to Ask Azure DB for PostgreSQL.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.