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'); ...