A quick over view of facebook's db?
Posted
by Matt
on Stack Overflow
See other posts from Stack Overflow
or by Matt
Published on 2010-05-07T05:49:25Z
Indexed on
2010/05/07
5:58 UTC
Read the original article
Hit count: 291
Hey guys I find it hard to believe that Facebook uses simple sql, surely it would use some other method but lets assume for now it does use sql how would the code assimilating the 'wall' work?
Lets say that there is three tables (just for the example)
Friends: id (entry key) - uid(your id) - fid (your mates' id)
Wall:id (entry key) - username - comment - time - commentcount
comments: id (entry key) - wid (wall id (original comment)) - reply - time
Lets forget about the like part and report etc, as well as mod things (ip, ban etc.) How would this work?
Select wall.id, wall.username, wall.comment, wall.time, wall.commentcount, comments.wid, comments.reply, comments.time FROM wall inner join comments ON wall.id=comments.wid ORDER BY wall.time;
That's your own wall but how do they get friend's? A heap of unions?
© Stack Overflow or respective owner