Cassandra: Unknown/dynamic filters on a table, like a "feed" of tweets from an unbounded number of people

时间:2015-08-07 02:34:46

标签: twitter cassandra filtering denormalization

I get/understand the concept of creating tables to satisfy a specific query.

But, what about queries that are dynamic?

Let's say I create a "tweet" table. I follow two users, Paul and Jim. Surely, there isn't a "tweets_by_paul_and_jim" table. So what do I do?

Do I query the results for each user query, and combine them into a sorted list for each request, AT request time? This really won't work because a user could follow 30,000+ (unbounded) number of people.

How does twitter solve this problem?

1 个答案:

答案 0 :(得分:1)

如果您发送推文,则会在您的每个关注者时间轴中结束。 Twitter将使用扇出方法将消息简单地写入每个时间线。您可以在this article中详细了解几年前这种方法的用法。