Hey guys, it’s hard for me to believe that Facebook uses simple sql, of course, it will use some other method, but suppose now it uses sql, how would the code assimilating the work of the “wall”?
Suppose there are three tables (for example only)
Friends: id (enter key) - uid (your id) - fid (identifier of your friends)
Wall: id (enter key) - username - comment - time - comment
comments: id (enter key) - wid (wall identifier (original comment)) - response - time
Let's forget about the similar part and message, etc., as well as the mod (ip, ban, etc.). How it works?
Select wall.id, wall.username, wall.comment, wall.time, wall.commentcount, comments.wid, comments.reply, comments.time FROM wall internal join comments ON wall.id = comments.wid ORDER BY wall.time ;
What is your own wall, but how do they get a friend? A bunch of unions?
source share