Create an MD5 hash of an entire DB row to use as a key?

239 Views Asked by At

I have a foreign database that I need to replicate in-house. The DB is hosted by an, uncooperative, vendor. So I have little control over it. I do have the ability to write report reports that I call via API to bring the data down as I move them into a local Oracle DB. However, several of the tables do NOT have unique fields, I can't add one, and in fact, after some investigation it appears the only way to get a unique field is to concatenate the entire row which is not desirable for obvious reasons. I can, however, execute PHP script on the report as its called, so my idea was to create an MD5 hash of the entire row and store that at the beginning of the table as the key.

I realize that it's possible to have collisions but they should be very rare. Given the pitfalls of not having a key, I'd prefer losing a record every few million rows than having thousands of duplicates should we ever have to reflow the DB. Are there any other pitfalls of this method I should be worried about? I'm trying to make the best of a bad situation, I realize that this isn't a perfect solution. I just want to make sure I give my boss the best information regarding the pitfalls of this so we're not suprised down the road. And yes, the vendors getting dumped, that's why we're replicating the DB.

0

There are 0 best solutions below