Live data from Hacker News

Ask HN: How does Twitter implement following and followers between users?

news.ycombinator.com

1–4 of 4 posts

Re: Ask HN: How does Twitter implement following and followers between users?

#3
--- USER TABLE ---

| 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.

Re: Ask HN: How does Twitter implement following and followers between users?

#4
In 2010, Twitter was using a graph database, FlockDB, instead of a relational database to implement their social graph where relationships like following and followers are represented as edges between nodes that represent people. It's since been deprecated, and I'm not sure what type of database they're using today. Anyway, they have a nice write-up blog post [1] and FlockDB is open source [2].

[1]: https://blog.twitter.com/engineering/en_us/a/2010/introducin...

[2]: https://github.com/twitter-archive/flockdb