Restricting by part of a partition key

The Our status_update_replies table has a two-column partition key consisting of status_update_username and status_update_id. In some cases, we may want to, for instance, retrieve all of the replies to a certain user's status updates. It would be nice if we could query by part of the partition key.

Let's insert a row into status_update_replies, and then try to retrieve it using only the status_update_username column:

INSERT INTO "status_update_replies"("status_update_username", "status_update_id", "id", "body")VALUES( 'alice', 76e7a4d0-e796-11e3-90ce-5f98e903bf02, NOW(), 'Good luck!');

Let's take a look at the table contents:

SELECT * FROM "status_update_replies"WHERE "status_update_username" = 'alice'; ...

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.