Guid uniqueness - collisions

Oct 5, 2015 at 10:41 AM
Hope you did not miss me too much!

Current flow in when I need to save a document in the view is

raptodDB.Save(object.ID, object)

where ID is a Guid. I know Guids are designed to be unique - but the algorithm does not guarantee the uniqueness even if collision chances are small. But if they do occur, does this mean that the new document saved in the view will overwrite the old one? If the answer is yes, how can I make sure I have only unique IDs in the database? The database is used only for write/search and there will be no updates.

Oct 5, 2015 at 11:46 AM
In the case of Guid collisions the new document will be appended to the storage and depending on how you have setup your view i.e. DeleteBeforeInsert=true then the old row will be removed and a new row will be added with data from the new document.

You can get the history for a Guid with FetchHistory() to track down collisions.

I would not worry about guid collision, I haven't come across one yet!
Oct 5, 2015 at 12:37 PM
It's also really hard to reproduce and probably that's why no one reported it. Also, for a big number of results - there are few people who are really checking the count of results. I expect this project to run for few years and to have few hundred of millions of documents inserted for different views, in various moments. The biggest view size can be up to 1M records. So, for such a long time-span, collisions may appear.

So, DeleteBeforeInsert=true allows me to store documents with the same Guid-ID. It would be a shame to keep also a local-hash/dictionary to check in it for each guid if it was inserted before.
Oct 5, 2015 at 12:44 PM
I've been using guid's for more than 10 years in ERP/distribution software package (last check >350gb data) in 10 different branches, nobody has complained about their sales bonuses going missing yet! :)