How is the 'friends' table in Facebook constructed?
Hi all,
does anyone know how facebook makes it possible to organise all these related friends. Millions of people are on Facebook, and they all have about 50 friends on average. How do they construct the database?
a many-to-many relationship created by a `user_friends` table. i would imagine the user_friends table having field such as `user1`, `user2`, and then properties of the relationship such as `status`, `created_on`, and any more they might have.
of course, this is all speculation, no one knows for sure, and if they do, they won't be posting the answer here on sitepoint.
i forgot to mention that the trick is not in designing the database, but rather optimizing the queries. the data is all there, finding the best way to pick it out is what might be a little bit harder for some people.
So there's no magic in it, I guess, except for smart querying off course? Not even with millions and millions of rows? Because I can't imagina the size of the many2many table with the relationships.
Bookmarks