Here's something even easier. Do your difference detection *outside* of Pg. Save the previous version of your data and compare it with the latest using something apropos like diff(1) or Algorithm::Diff. You can use that to make just the specific changes required to keep your database synched up.