Database Reference
In-Depth Information
Another advantage of UUIDs
As it turns out, the users table is the only table in the MyStatus keyspace that has this
problem. All the other tables use UUIDs in their primary keys; since UUIDs are guaranteed
to be globally unique, we simply don't have to worry about what might happen in the case
of a primary key collision.
UUIDs are great in the case where the table doesn't have a natural key, as we discussed in
Chapter 2 , The First Table . However, using a UUID key in the users table won't solve the
fundamental problem, since we still want to guarantee that usernames are unique. A user-
name collision would be less catastrophic, since at least we wouldn't overwrite data;
However, we'd have also forfeited the only structure Cassandra gives us for guaranteeing
uniqueness, the primary key. Fortunately, there's a better way.
Search WWH ::




Custom Search