uuid - Cassandra: Generate a unique ID? -
i'm working on distributed data base. i'm trying generate unique id serve column family primary key in cassandra.
i read articles doing java using uuid
seems there probability collision (even if it's low).
i wonder if there way generate unique id based on time maybe?
you can use timeuuid
type in cassandra, creates type 1 uuid. uses time , creator's mac address , sequence number. if sequence number generated correctly can done 0 collisions. main advantage of timeuuids
ids can time ordered. see http://wiki.apache.org/cassandra/timebaseuuidnotes more info.
however, time ordering unlikely useful row keys, since ordering useless when using hash partitioner. , complexity of generating unique id source of bugs. cassandra supports type 4 uuids using uuid
type. these random bits. there collision probability, collision probability (assuming uncorrelated random number sources, if generate in java) extremely low - if created 1 billion second 100 years probability of 1 collision 50%. (see http://en.wikipedia.org/wiki/universally_unique_identifier#random_uuid_probability_of_duplicates more details.)
Comments
Post a Comment