Answer by floriank for Facebook database design?
TL;DR:They use a stack architecture with cached graphs for everything above the MySQL bottom of their stack.Long Answer:I did some research on this myself because I was curious how they handle their...
View ArticleAnswer by deep9c for Facebook database design?
Probably there is a table, which stores the friend <-> user relation, say "frnd_list", having fields 'user_id','frnd_id'. Whenever a user adds another user as a friend, two new rows are created....
View ArticleAnswer by zain for Facebook database design?
Its a type of graph database:http://components.neo4j.org/neo4j-examples/1.2-SNAPSHOT/social-network.htmlIts not related to Relational databases.Google for graph databases.
View ArticleAnswer by user362541 for Facebook database design?
It's not possible to retrieve data from RDBMS for user friends data for data which cross more than half a billion at a constant timeso Facebook implemented this using a hash database (no SQL) and they...
View ArticleAnswer by Simon for Facebook database design?
Have a look at the following database schema, reverse engineered by Anatoly Lubarsky:
View ArticleAnswer by Cade Roux for Facebook database design?
Regarding the performance of a many-to-many table, if you have 2 32-bit ints linking user IDs, your basic data storage for 200,000,000 users averaging 200 friends apiece is just under 300GB.Obviously,...
View ArticleAnswer by Adrian J. Moreno for Facebook database design?
Take a look at these articles describing how LinkedIn and Digg are built:http://hurvitz.org/blog/2008/06/linkedin-architecturehttp://highscalability.com/scaling-digg-and-other-web-applicationsThere's...
View ArticleAnswer by Malfist for Facebook database design?
You're looking for foreign keys. Basically you can't have an array in a database unless it has it's own table.Example schema: Users Table userID PK other data Friends Table userID -- FK to users's...
View ArticleAnswer by belgariontheking for Facebook database design?
My best bet is that they created a graph structure. The nodes are users and "friendships" are edges.Keep one table of users, keep another table of edges. Then you can keep data about the edges, like...
View ArticleAnswer by TheTXI for Facebook database design?
Keep a friend table that holds the UserID and then the UserID of the friend (we will call it FriendID). Both columns would be foreign keys back to the Users table.Somewhat useful example:Table Name:...
View ArticleAnswer by Nathan Koop for Facebook database design?
It's most likely a many to many relationship:FriendList (table)user_id -> users.user_idfriend_id -> users.user_idfriendVisibilityLevelEDITThe user table probably doesn't have user_email as a PK,...
View ArticleFacebook database design?
I have always wondered how Facebook designed the friend <-> user relation.I figure the user table is something like this:user_email PKuser_id PKpassword I figure the table with user's data (sex,...
View Article