How is Facebook doing its queries?
February 4, 2008 9:49 AM Subscribe
How does Facebook handle or simplify the presumably complicated DB queries involved so that me loading my page doesn't bring it to its knees?
When I pull up my homepage on Facebook, it pulls status updates for a subset of my friends, and recent bits of their activity. It filters out the ones that are related to people who have blocked me (hopefully none!) and then shows it all to me.
This information is all very specific to me, so presumably caching won't help much with it. But it seems like a hell of a lot of DB queries. If that's so -- it may merely be my "SELECT *"-level understanding of SQL making it seem that way -- how do they do it efficiently?
(I'm particularly interested in how the 'blocked user' can work: would it really pull a status update like "Matt Haughey and Jessamyn West are now friends", then pull Jess's block list to see if I'm on it? That's two hits for a one-line entry!)
posted by bonaldi to computers & internet (27 answers total) 83 users marked this as a favorite
posted by mpls2 at 9:51 AM on February 4, 2008