Composite partition key with multiple clustering columns

It is also possible to declare a table that has both a composite partition key as well as multiple clustering columns. Suppose we wish to model a status update replies table to be clustered by the reply date first and then the reply time; we would have a table like this:

CREATE TABLE "status_update_replies" (   "status_update_username" text,   "status_update_id" timeuuid,    "status_date" date,    "status_time" time,   "id" timeuuid,   "author_username" text,   "body" text,   PRIMARY KEY (     ("status_update_username", "status_update_id"),     "status_date", "status_time", "id"   ) );

In the preceding table, the partition key is a combination of status_update_username and status_update_id.

The replies ...

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.