LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File postgresql-README.SUSE of Package postgresql93 (Project server:database:postgresql)

Newer versions of PostgreSQL come with the pg_upgrade tool that
simplifies and speeds up the migration of a PostgreSQL installation to
a new version. Formerly dump and restore was needed that was much
slower.

pg_upgrade needs to have the server binaries of both versions
available. To allow this, we had to change the way PostgreSQL is
packaged as well as the naming of the packages, so that two or more
versions of PostgreSQL can be installed in parallel.

Starting with version 9.1, PostgreSQL package names contain numbers
indicating the major version. In PostgreSQL terms the major version
consists of the first two components of the version number, i.e. 8.3,
8.4, 9.0, or 9.1. So, the packages for Postgresql 9.1 are named
postgresql91, postgresql91-server, etc. Inside the packages the files
were moved from their standard locations to a versioned location such
as /usr/lib/postgresql83/bin or /usr/lib/postgresql91/bin to avoid
file conflicts if packages are installed in parallel. The
update-alternatives mechanism creates and maintains symbolic links
that cause one version (by default the highest installed version) to
re-appear in the standard locations. By default, database data are
stored under /var/lib/pgsql/data on SUSE Linux.

The following preconditions have to be fulfilled before data migration
can be started:

 1. If not already done, the packages of the old PostgreSQL version
 must be upgraded to the new packaging scheme through a maintenance
 update. For SLE11 this means to install the patch that upgrades
 PostgreSQL from version 8.3.14 to 8.3.19 or higher.

 2. The packages of the new PostgreSQL major version need to be
 installed. For SLE11 this means to install postgresql91-server and
 all the packages it depends on. As pg_upgrade is contained in
 postgresql91-contrib, that one has to be installed as well, at least
 until the migration is done.

 3. Unless pg_upgrade is used in link mode, the server must have
 enough free disk space to temporarily hold a copy of the database
 files. If the database instance was installed in the default
 location, the needed space in megabytes can be determined by running
 the follwing command as root: "du -hs /var/lib/pgsql/data". If space
 is tight, it might help to run the "VACUUM FULL" SQL command on each
 database in the instance to be migrated, but be aware that it might
 take very long.

Upstream documentation about pg_upgrade including step by step
instructions for performing a database migration can be found under
file:///usr/share/doc/packages/postgresql91/html/pgupgrade.html (if
the postgresql91-docs package is installed), or online under
http://www.postgresql.org/docs/9.1/static/pgupgrade.html .

NOTE: The online documentation starts with explaining how you can
install PostgreSQL from the upstream sources (which is not necessary
on SLES) and also uses other directory names (/usr/local instead of
the update-alternatives based path as described above).

For background information about the inner workings of pg_admin and a
performance comparison with the old dump and restore method, see
http://momjian.us/main/writings/pgsql/pg_upgrade.pdf .