![]() |
活泼的铁链 · 濮潢铁路 - 搜狗百科· 6 月前 · |
![]() |
儒雅的保温杯 · 基于改进确定性采样滤波的疲劳裂纹扩展RUL预测· 6 月前 · |
![]() |
气宇轩昂的红薯 · 世界历史上最大毒贩:1992年7月22日哥伦 ...· 8 月前 · |
![]() |
怕考试的炒粉 · SQL Server ...· 9 月前 · |
![]() |
伤情的咖啡 · h5播放video在android中脱离文档 ...· 10 月前 · |
See all of Percona’s upcoming events and view materials like webinars and forums from past events
View Our EventsPercona is an open source database software, support, and services company that helps make databases and applications run better.
Learn MoreSee Percona’s recent news coverage, press releases and industry recognition for our open source software and support.
News coverage Press ReleasesMy last blog introduced the issues one can face when upgrading PostGIS and PostgreSQL at the same time. The purpose of this blog is to walk through the steps with an example.
For our purposes, we will confine ourselves to working with the community versions of 9.6 and 11 respectively, and use LXD in order to create a working environment prototyping the steps, and profiling the issues.
The first step is creating a template container with the requisite packages and configurations. This template is a basic distribution of Ubuntu 18.04, which has already been installed in the development environment.
These packages install the necessary supporting packages, installing PostgreSQL from the community repository:
The aforementioned repository is now updated thus making it possible to install our two versions of PostgreSQL (i.e. 9.6 and 11, respectively). Installing pg_repack pulls in the requisite packages while installing this very useful package at the same time too:
These next packages are useful. Midnight Commander, mc, is a terminal-based shell navigator and file manager while the other package installs utilities, such as netstat, to monitor the status of all network-based services on the localhost:
This last step merely updates the man pages database and the mlocate database. It makes it easier to locate files on the host. Beware this can be a security risk if used on a production host .
This little snippet of code creates our simulated production host. Creating the instance from a template container makes it much easier to try different variations in quick order:
As per our scenario, upgrading PostGIS requires two different versions to be installed on the host. Notice that PostgreSQL version 9.6 has the older version of PostGIS, while version 11 has the newer one.
For our purposes, this presentation assumes upgrading both PostgreSQL and PostGIS is the method to be used.
ATTENTION: Executing this upgrade operation into two distinct phases is preferred. Either upgrade PostgreSQL and then upgrade PostGIS or upgrade PostGIS on the old version to match the new version on PostgreSQL and then upgrade the PostgreSQL data cluster.
The underlying assumption is that application code can break between PostGIS version upgrades therefore pursuing an incremental process can mitigate potential issues.
https://PostGIS.net/docs/PostGIS_Extensions_Upgrade.html
https://PostGIS.net/workshops/PostGIS-intro/upgrades.html
Available versions of PostGIS, as per the community repository at the time of this blog’s publication:
ATTENTION : Azure supports only PostgreSQL 9.6 with PostGIS 2.3.2.
This query lists all user-defined functions that have been installed in your database. Use it to summarize not only what you’ve created but the entire suite of PostGIS function calls:
In order to validate your functions, you need to know which ones are being used, therefore tracking the functions prior to the upgrade process will identify them. Please note there are two settings i.e. pl , all . Out of an abundance of caution, it is suggested initially using all for an extended period of time:
This is a simple example demonstrating tracking function call usage. Note there are two function calls and one of them is invoked in the other:
This SQL statement resets all statistics being tracked in the PostgreSQL database. Please note there are other functions that can be used to reset specific statistics while preserving others:
There are two discrete upgrades:
An Ubuntu-based upgrade requires removing the target data cluster because installing PostgreSQL packages onto a Debian-based distro always includes creating a data cluster:
For our purposes we are simply adding the extension, no user-defined functions have been included:
Shutting down the source data cluster is the last step before the upgrade process can begin:
It’s important to check the upgrade logs before starting PostgreSQL version 11. This is a one-way process and once it’s active the old PostgreSQL 9.6 cluster is no longer available and must be destroyed:
This is critical; the process validates that the application logic works or that it must be updated.
METHOD: inspect each function call used between all versions:
TIP : 3.1 documentation encapsulates all previous versions i.e. section 9.12
REFERENCES:
Be advised, cloud environments are not ideal upgrade candidates. The aforementioned process is quite detailed and will facilitate a successful upgrade process.
References:
https://docs.microsoft.com/en-us/azure/postgresql/concepts-extensions
https://docs.microsoft.com/en-us/azure/postgresql/concepts-extensions#postgres-96-extensions
https://docs.microsoft.com/en-us/azure/postgresql/concepts-extensions#postgres-11-extensions
As more companies look at migrating away from Oracle or implementing new databases alongside their applications, PostgreSQL is often the best option for those who want to run on open source databases.
Read Our New White Paper:
Why Customers Choose Percona for PostgreSQL
By submitting my information I agree that Percona may use my personal data in sending communication to me about Percona services. I understand that I can unsubscribe from the communication at any time in accordance with the Percona Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.