How to compare data between two databases in PostgreSQL?

There are several tools out there:

(note that most of these tools can only compare structure, but not data)

Free Ones:

  • pgquarrel: http://eulerto.github.io/pgquarrel (schema diff)
  • apgdiff http://apgdiff.com/ (schema diff)
  • Liquibase (Cross DBMS): http://www.liquibase.org (schema diff)
  • pgAdmin https://www.pgadmin.org (schema diff in pgAdmin4)
  • WbDataDiff (Cross DBMS): http://www.sql-workbench.net/manual/compare-commands.html#command-data-diff (data diff)
  • WbSchemaDiff (Cross DBMS): http://www.sql-workbench.net/manual/compare-commands.html
  • Migra https://migra.djrobstep.com/ (schema diff)

Commercial:

  • DB Comparer: http://www.sqlmanager.net/en/products/postgresql/dbcomparer
  • Aqua Data Studio: http://docs.aquafold.com/docs-diff-schema.html
  • DB Solo: http://www.dbsolo.com/index.html (30 day trial)
  • PostgresCompare: https://www.postgrescompare.com/ (14 day trial, compares schema and data)

Another free app (that can only compare structure, but not data):

DBeaver - you can select databases, tables, etc to compare with each other


Try using pg_dump on both databases and diffing the files.