Question

To tag the data we create, I'm considering using uuids. Security is not an issue, so I was going to use version 1 (date-and-mac-address-based). The only concern is that each user may be creating multiple data files at once from different processes with multiple threads. Assuming Python's uuid library is thread-safe (though it doesn't look it), that still leaves the multiple process issue. I'm considering suffixing the uuid with a dash and the process number.

Since our group has little experience with uuids, are there any issues I need to keep in mind? How is the multiple process issue usually handled?

Was it helpful?

Solution

Just use uuid4 for completely random UUIDs. There is no need to worry about collisions.

edit in response to comment: In my experience, redundant data leads to inconsistencies sooner or later. There is a reason that avoiding redundancy is a dogma of relational database design.

So don't use the UUID as a "redundancy backup" for the actual "originating computer" and "timestamp" data. Either use it as a pure unique ID carrying no other information, or don't use it at all.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top