Database Design - Push or Fan-out-on-write Model

Background Information:

I am trying to get images from the people I adhere to, sort by the latest time. This is similar to the Twitter feed in which they show the latest news from your friends.

Plans:

Currently, there is only one element that I need to consider, that is, images. In the future, I plan to analyze user behavior and add other images that they may like, etc.

http://www.quora.com/What-are-best-practices-for-building-something-like-a-News-Feed

I personally think that the “Pull” or “Fan-out-on-load” model, where I pull out all the information in real time, will be worse than the push model. Because imagine that I have 100 of the following, I will need to select and sort by time. (Let me know if I'm wrong, for example, Read is 100 times better than Write (Push Model)

The current construction of the push model, which I mean, is as follows

Table users_feed(ID, User_ID, Image_ID,datetime)

Option 1: Save List Image_ID

Option 2: Keep one image identifier and duplicate lines (more lines of the same User_ID but different Image_ID)

, , , , 50 . , 50 . ( , , )

1

, , , "", . Write? 200 = 200 ?

2

, , . .

3

( push), ?

Insert xxx into feeds whereIn (array of FriendsID)?

. !

+3
1

pull push :

  • .

  • (, 10M 10M 1 ).

  • , :

    SELECT * FROM users_feed WHERE a.user_id (<//  user_ids // " > )

    ( )

+2

All Articles