
上QQ阅读APP看书,第一时间看更新
UUIDs and timestamps
While there are several algorithms that can be used to generate UUIDs, the Version 1 UUID has an additional useful property: part of the UUID encodes the timestamp at which the UUID is generated. This timestamp can be extracted from the full UUID, meaning that it's possible to know exactly when any Version 1 UUID was generated.
Cassandra's timeuuid type lets us capitalize on that property. Cassandra is aware of the structure of a timeuuid and is able to both convert timestamps into UUIDs and extract the creation timestamp from a UUID. As we'll soon see, Cassandra can also sort our rows by their creation time using the timestamps encoded in the UUIDs.