We are using Cassandra for our social network and we are designing/data
modeling tables we need, it is confusing for us and we don't know how to
design some tables and we have some little problems!

*As we understood for every query we have to have different tables*, and
for example user A is following user C and B.

Now, in Cassandra we have a table that is posts_by_user:

user_id      |  post_id       |  text  |  created_on  |  deleted  |
view_count

likes_count  |  comments_count  |  user_full_name

And we have a table according to the followers of users, we insert the
post's info to the table called user_timeline that when the follower users
are visiting the first web page we get the post from database from
user_timeline table.
And here is user_timeline table:

follower_id      |      post_id      | user_id (who posted)  |  likes_count  |

comments_count   |   location_name   |  user_full_name

*First, Is this data modeling correct for follow base (follower, following
actions) social network?*

And now we want to count likes of a post, as you see we have number of
likes in both tables*(user_timeline, posts_by_user)*, and imagine one user
has 1000 followers then by each like action we have to update all 1000 rows
in user_timeline and 1 row in posts_by_users; And this is not logical!
*Then, my second question is How should it be? I mean how should like
(favorite) table be?*

Thank you
I wish I can get answer

Reply via email to