O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Facebook Query Language (FQL)

Let’s say that you’d been puttering around town in a beat-up old jalopy and you pulled up to a traffic light. You dig your jalopy in a very Archie kind of way, even though it’s a little slow sometimes and uses a lot of gas, but it’s your car and it’s all you’ve known. And now let’s say, while you’re sitting there at the light, a brand new Formula 1 race car comes screaming up to a stop right next to you, tires smoking. Sure, your jalopy is nice and all, but think how much faster you could get your shopping done in that baby! Now think of your jalopy as the Facebook API and the sleek, sexy, speedy race car as FQL.

See, here’s the dirty little secret about APIs: they’re all the rage with the kids these days, and they’re a joy to program in, but they’re not particularly efficient when you’re worried about your app scaling to hundreds of thousands of users. If you’re building a Facebook app that you think will really take off and you want to make sure you’re being as future-proof as possible, you should consider using FQL for key queries for the following reasons:

Decreased result sets

When you’re working with the API and you request the friends of a specific user, you get all the info back about everybody and then parse through the results. FQL gives you the ability to limit the fields you want returned and to put more conditions on your queries, thereby reducing the size of the result set and the bandwidth consumed. If you change a key query from ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required