The problem
How do I efficiently and idiomatically compare the content of two tables, each in a different DB?
I have 3 DBs (the classic dev, stg and prod). Each DB has a few tables which should be exactly the same regardless of environment, like countries.
I would like to write a script that would compare these tables and alert me when there's a mismatch.
Characteristics
- There are less than 10 tables to compare
- The tables are not very large - at most ~100K of data
- The script is executed from a Jenkins CI machine
Current solution
Currently, I am using pg_dump and comparing the files. I wonder if there is a more idiomatic approach.