If your installation directory is not version-specific, e.g., /usr/local/pgsql, it is necessary to move the current PostgreSQL install directory so it does not interfere with the new PostgreSQL installation. The graphical installers all use version-specific installation directories. If you are using a version-specific installation directory, e.g., /opt/PostgreSQL/10, you do not need to move the old cluster. Retain SQL and log files even after successful completion -U usernameĬluster's install user name environment variable PGUSER -vĭisplay version information, then exit -? The new cluster port number environment variable PGPORTNEW -r The old cluster port number environment variable PGPORTOLD -P port Options to be passed directly to the new postgres command multiple option invocations are appended -p port Options to be passed directly to the old postgres command multiple option invocations are appended -O options
Use hard links instead of copying files to the new cluster -o options Number of simultaneous processes or threads to use -k The new database cluster configuration directory environment variable PGDATANEW -j njobs The old database cluster configuration directory environment variable PGDATAOLD -D configdir The new PostgreSQL executable directory environment variable PGBINNEW -cĬheck clusters only, don't change any data -d configdir
The old PostgreSQL executable directory environment variable PGBINOLD -B bindir Pg_upgrade supports upgrades from 8.4.X and later to the current major release of PostgreSQL, including snapshot and beta releases. It is important that any external modules are also binary compatible, though this cannot be checked by pg_upgrade. Pg_upgrade does its best to make sure the old and new clusters are binary-compatible, e.g., by checking for compatible compile-time settings, including 32/64-bit binaries. (The community will attempt to avoid such situations.) If a future major release ever changes the data storage format in a way that makes the old data format unreadable, pg_upgrade will not be usable for such upgrades. pg_upgrade uses this fact to perform rapid upgrades by creating new system tables and simply reusing the old user data files. Major PostgreSQL releases regularly add new features that often change the layout of the system tables, but the internal data storage format rarely changes. It is not required for minor version upgrades, e.g., from 9.6.2 to 9.6.3 or from 10.1 to 10.2. Pg_upgrade (formerly called pg_migrator) allows data stored in PostgreSQL data files to be upgraded to a later PostgreSQL major version without the data dump/reload typically required for major version upgrades, e.g., from 9.5.8 to 9.6.4 or from 10.7 to 11.2.