Ask HN: How does Twitter implement following and followers between users?
I have always been curious as to how twitter implemented this in their user model. How do they keep track of who the user is following and who is following the user?
[1]: https://blog.twitter.com/engineering/en_us/a/2010/introducin...
| USER_ID |
| USERNAME |
| NB_FOLLOWERS |
| TWEETS -> List of TWEET_ID's |
| FOLLOWING -> List of USER_ID's |
| FOLLOWED_BY -> List of USER_ID's |
etc.
NB_FOLLOWERS, FOLLOWING and FOLLOWED_BY are updated when a USER follows/unfollows another USER.
User1 follows User3
User3 follows User1
User3 follows User5
...