Generating the timeline

We now have all the data we need to generate a home timeline for alice. First, we require a list of users that alice follows:

SELECT "followed_username" FROM "user_outbound_follows" WHERE "follower_username" = 'alice';

This is a straightforward single-partition query, simply looking up all of the rows in the alice partition in the user_outbound_follows table. We'll get back the usernames of those users whose updates alice is interested in:

Now we need to retrieve all of the status updates for these users:

SELECT "id", UNIXTIMESTAMPOF("id"), "body" FROM "user_status_updates" WHERE "username" IN ('carol', 'dave'); ...

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.