DrJohnZoidberg
Honorary Master
Hey all,
Just want to pick your collective brains quick.
I am currently receiving some daily reports, the records don't have unique id's. I am using mysqlimport in the linux cli to pull them into my database, but to prevent the same data being imported more than once I am creating a unique field based off a 3 columns before importing it, e.g) I create a string with the date, username and transaction type like "2014/11/01User999TransactionType1".
This is working fine but these strings can get quite long depending on the source data so I was thinking of creating a hash out of the string and then storing the hash as the unique value.
Is this a good idea? I've Googled a bit and it is apparently highly unlikely I will have any collisions. Will it matter if I use md5 or sha1 when it comes to possible collisions?
TIA
Just want to pick your collective brains quick.
I am currently receiving some daily reports, the records don't have unique id's. I am using mysqlimport in the linux cli to pull them into my database, but to prevent the same data being imported more than once I am creating a unique field based off a 3 columns before importing it, e.g) I create a string with the date, username and transaction type like "2014/11/01User999TransactionType1".
This is working fine but these strings can get quite long depending on the source data so I was thinking of creating a hash out of the string and then storing the hash as the unique value.
Is this a good idea? I've Googled a bit and it is apparently highly unlikely I will have any collisions. Will it matter if I use md5 or sha1 when it comes to possible collisions?
TIA