Upgrading PostgreSQL 15 to 18 Using pg_upgrade
PostgreSQL provides pg_upgrade to upgrade an existing database cluster to a newer major version without requiring a logical dump and restore. In this article, I’ll demonstrate how to upgrade PostgreSQL 15 to PostgreSQL 18 using pg_upgrade with the — link option. Unlike a traditional dump-and-restore approach, link mode allows PostgreSQL to reuse the existing relation files through hard links, significantly reducing the time and disk space required for an upgrade. 1. Checking the Existing PostgreSQL 15 Environment First, let’s check the existing PostgreSQL installation and its configuration. I’m using the following environment variables and version: [postgres @OEL98 - PG ~] $ export PGHOME = /usr/pgsql - 15 [postgres @OEL98 - PG ~] $ export PGDATA = /var/lib /pgsql/ 15 /data [postgres @OEL98 - PG ~] $ export PGPORT = 5415 postgres= # select version(); version -------------------------------------------------------------------...