Database Reference
In-Depth Information
Now that we've got a handful of rows in the
user_status_updates
table, let's take a
look at its contents:
SELECT "username", "id", "body", UNIXTIMESTAMPOF("id")
FROM "user_status_updates";
As we did previously, we'll ask Cassandra to return the millisecond-precision timestamp
of the UUIDs in the table along with the data in all columns. Let's take a look at the res-
ults:
We notice a couple of interesting things here. First, we can see that results are grouped by
username: all the status updates of
bob
appear first, followed by all the status updates of
alice
. This is despite the fact that we interleaved the status updates of
alice
and
bob
when we inserted them.
Second, within each user's status updates, the updates are returned in ascending order of
the timestamp of the row's
id
column. Looking at the rightmost column in the results, we
see that the timestamps monotonically increase for each user. This is no coincidence; the
id
column determines the ordering of rows in the
user_status_updates
table, and
since it's a
timeuuid
column, the timestamp encoded in the UUID determines the se-
mantic ordering of the rows.