开发者

How best structure or query data to display similar to the "feed" in facebook?

开发者 https://www.devze.com 2022-12-11 06:52 出处:网络
Our app is displaying its information in a way similar to that found on Facebook\'s \"feed\" page which shows a timeline of activity by members of the particular profile\'s network.

Our app is displaying its information in a way similar to that found on Facebook's "feed" page which shows a timeline of activity by members of the particular profile's network.

I can see that could be very heavy if done with a relational/sql-statement in a traditional sense, but wante开发者_StackOverflow中文版d some ideas on how to best do so in a way that wasn't so 'expensive' -- ideally, I could keep things in a relational table and there were some clever approached.

The types of data we have a people, companies, and type of action.

Thanks!


You just need a timestamp (date and time) in every table holding a relevant information. For instance you can have a table with posts, a table with comments and one with shared links. Just join the three tables by user, order the rows by the timestamp than display it in your view.

If you need performance you can run a scheduled job to do this processing, in the background, then you can store the results in a ad-hoc table something like:

activity type: post

content: A title of...

timestamp: 2010-02-02 22:17:11


Facebook uses something called MultiFeed for doing this. The API details this data type, but it is currently deprecated.

http://wiki.developers.facebook.com/index.php/MultiFeedStory_form

0

精彩评论

暂无评论...
验证码 换一张
取 消