How can I compare the data which is present in different database in postgresql.

For example, I have 2 databases db1 & db2

Both have the same tables like tb1 tb2 tb3

I want to compare which table has different record.


you could use the postgres_fdw to link the 2 dbs together and execute queries to compare the different tables as if they we're in the same db.

see the documentation on postgres_fdw for examples.
Note, this requires that you will be able to connect from one db to the other remotely. and queries might be resource intensive (as you are basically pulling the data of the remote table over the wire)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.