Displaying the home timeline

Now, let's say alice wants to view her home timeline. In the home_status_update_ids table, we have a partition that contains exactly what we need: references to status updates that alice is interested in, in descending order of creation time. So, to know what status updates we want to display to alice, we simply perform a range query on her partition:

SELECT "status_update_username", "status_update_id" FROM "home_status_update_ids" WHERE "timeline_username" = 'alice'; 

Note that we don't need an explicit ORDER BY clause because we created the table with descending clustering order; as long as we're working within a single partition, results will, by default, be returned in the order we want:

So now we know ...

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.