I'm trying to learn database design by creating a twitter clone.. And I was wondering what's the most efficient way of creating the friends' timeline function. I am implementing this in Google App Engine, which uses Big Table to store the data. IIRC, this means very fast read speed(gets), but considerably slower page queries, and this also means considerably slower write speeds. Currently in my mind there are two methods, each with its setbacks:
For each user, there's a list structure that's their friends' timeline. Everytime someone makes a tweet, this structure gets updated for each of its followers. This method uses a lot of write operations, but for each user retrieving the list it will seem very fast.
or
For each user, calculate the friends' timeline dynamically by getting all the tweets of the people he's following, and do a merge of all the tweets to get a friends' timeline(since for each individual person the tweets are sorted chronologically). This might be slow if the person is following a lot of people.
Are there some other ways that I'm not aware of? Both of these methods seem like it will make the system choke up when the number of users increase.