If you adore databases like we do, the launch of a new major version is an event you celebrate. With each new major version comes cutting-edge database features, performance boosts, and other goodies for database lovers like you. You can hardly wait to spin up a Cloud SQL instance to test out the freshest release for your new services! But how about those existing databases of yours–is there a way to get them upgraded?
Cloud SQL now supports in-place upgrades for PostgreSQL and SQL Server in preview. With in-place upgrades, you can upgrade your databases in just a few minutes with a single command. When you perform an in-place upgrade, Cloud SQL keeps things simple for you and maintains your database’s IP address, user data, and settings, so that you don’t have more work to do after the upgrade completes. Cloud SQL even takes care of the mundane steps, such as running compatibility checks and backing up your data. If an issue does arise during an upgrade, Cloud SQL automatically rolls your database back to the previous version, getting you back up and running right away. When compared with migration-based upgrades, in-place upgrades are faster, easier, and more reliable.
If you use SQL Server, you may also use in-place upgrades to upgrade your edition and take advantage of features in a more premium SQL Server offering, such as SQL Server Enterprise.
In-place upgrades can be performed with a few clicks from the Cloud Console, or through gcloud or the API. MySQL support is coming soon.
How to upgrade your database
Pretend you’re a database administrator at BuyLots, where you manage a fleet of Cloud SQL for PostgreSQL and SQL Server databases. The BuyLots fleet is on PostgreSQL 9.6 and SQL Server 2017–while that was state-of-the-art when you set up these databases four years ago, the software is now antiquated and you acknowledge it’s time for an update.
You do your homework and you decide to go straight to the latest and greatest with PostgreSQL 14 and SQL Server 2019. You see that PostgreSQL 14 offers major performance improvements for BuyLots’ connection-heavy workload and you can’t wait to try out SQL Server 2019’s accelerated database recovery feature. You check out the PostgreSQL and SQL Server documentation and find out that, fortunately, none of the incompatible changes introduced in the later versions are ones that you need to worry about. You know that upgrading incurs some downtime, so you check the calendar and decide that next month’s Saturday evening service update window–when BuyLots’ database activity is at its lowest–is the right moment to conduct the upgrade event.
In preparation for the upgrade event, you decide to do a dry run of your upgrade and kick the tires on PostgreSQL 14. You also want to get a sense for how long upgrading will take. You first clone one of your PostgreSQL 9.6 databases called inventory-db. After inventory-db-clone is created, you view the cloned instance’s Overview page from the Console and you click the Edit button. You spot the Upgrade button underneath the database version and you click it.
When you’re prompted to choose a major version to upgrade to, you click the drop down menu and select PostgreSQL 14.
On the next screen, you type in the cloned instance’s name to confirm that you are ready to start the upgrade.
Cloud SQL takes you back to the Overview page and you see the upgrade progress in real-time. You hold your breath for a moment–is it really this easy?
You leave for a brief moment to crush the daily Wordle (3 guesses!). When you click back a few minutes later: presto change-O! Your database is now on PostgreSQL 14!
You perform a few acceptance tests on the upgraded instance and things are running smoothly. You’re really impressed by how much faster things are running in PostgreSQL 14. You test out the upgrade procedure a few more times with other PostgreSQL and SQL Server instances in the fleet and everything looks good. You’re feeling ready as ever for the big upgrade event next month!
With in-place upgrades, you can now upgrade your database major version and benefit from the latest database features, performance advances, and other improvements. To learn more about in-place upgrades, see our documentation.
By: Akhil Jariwala (Product Manager, Cloud SQL)
Source: Google Cloud Blog