Search code examples
postgresqldatabase-migrationdatabase-replicationpostgresql-9.4postgresql-9.5

PostgreSQL replication between different major versions


AFAIK the documentation states:

In general, log shipping between servers running different major PostgreSQL release levels is not possible. It is the policy of the PostgreSQL Global Development Group not to make changes to disk formats during minor release upgrades, so it is likely that running different minor release levels on primary and standby servers will work successfully. However, no formal support for that is offered and you are advised to keep primary and standby servers at the same release level as much as possible.

But my question is: does disk format actually changes between 9.4.9 and 9.5.6?

We are currently running with:

  • PostgreSQL 9.4.9 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit
  • Debian GNU/Linux 8.6 (jessie)

And the 'next' possible step would be using the version from this repo:

http://apt.postgresql.org/pub/repos/apt/

Our current DB is about 2TB, so we'd like to try a replication-like approach for a smoother transition, rather tan a using a full pg_dump, which would actually need quite a while with the db frozen.


Solution

  • does disk format actually changes between 9.4.9 and 9.5.6

    Yes. Until the coming PostgreSQL 10, PostgreSQL used a wacky version scheme where "x.y" was the "major" version, and the 3rd number was the minor version.

    So 9.4 and 9.5 are different major versions. They are definitely not on-disk compatible.

    To upgrade you can:

    • Dump and reload
    • Use pg_upgrade (the officially recommended way)
    • Use pglogical
    • Use Londiste