PostgreSQL Database Comparison – How to Check if Two PostgreSQL Databases on Different Servers are Identical

postgresqlpostgresql-11postgresql-9.6

I copied an existing posttgresql database from one server to another. The source of my data is a postgresql 9.6 whilst the newer server is in postgresql 11.

So I want to know how I can check that both databases have the same schema and data in a fast and easy way?

Best Answer

You cannot do that in a fast way.

The best you can do is to dump both databases using pg_dump from v11 and compare the files with diff.

If you want to do that just to ensure that the migration was successful, don't. If you don't trust PostgreSQL's upgrade process, why should you trust pg_dump?