Is there a way to get a diff of two databases
I have a branch of a database which I've made some changes to. Is there a way to quickly determine the diff between the databases?
6 Replies
national-gold•6mo ago
You can perform a schema diff between branches: https://neon.tech/docs/guides/schema-diff-tutorial
Neon
Schema diff tutorial - Neon Docs
In this guide we will create an initial schema on a new database called people on our main branch. We'll then create a development branch called dev/jordan, following our recommended convention for na...
extended-salmonOP•6mo ago
Sorry, I'm looking for a difference in the row data, not the schema
national-gold•6mo ago
We currently don't have a data diff capability. There are some tools like dbforge that offer this: https://www.devart.com/dbforge/postgresql/datacompare/
You could potentially do a row-level diff via SQL by querying both databases and comparing results.
extended-salmonOP•6mo ago
Probably not worth it for something that has to read all rows, since that would take forever
I assume it's feasible for Neon to build something much faster since the branches are additive?
national-gold•6mo ago
We explored this in an internal hackathon a while back. It's not in plan right now, though. Can you tell us a bit more about how you would make use of this in your workflow?
extended-salmonOP•6mo ago
Yeah, so right now I'm using branches as a way to version manual changes to a database. I have a lot of LLM generated content associated with other data. I make manual fixes where the LLM generated incorrect information when necessary. The easiest system I could set up that did that which wasn't a custom versioning system for my data was using neon branches. I would like to be able to see what changed over time. Being able to create patch update commands from diffing beaches would also be cool.
Patches would also be cool because it would help ease the process of creating up-to-date local copies of the data