In the previous recipe, we saw how the pglogical extension can be installed to perform logical replication between two PostgreSQL servers. Streaming replication does not allow replication between two different Postgres major versions. For this reason, we can use logical replication to perform replication between two different PostgreSQL versions to perform a migration without huge downtime. As an example, we could configure logical replication between the PostgreSQL 9.6 and 12 versions using the pglogical extension. As long as all the tables have primary keys, this procedure should work. In this recipe, we shall discuss the steps involved in performing a logical replication between multiple PostgreSQL versions using the pglogical extension.
Getting ready
In order to proceed with this approach, we need to have the pglogical extension installed in both the old and the new version of the PostgreSQL servers. We can use pglogical to...