Facebook Releases FQL.multiquery

-Matrix Image-If you’re a developer you’ll know that one of the most important things to making efficient code is to reduce your code’s dependency on SQL queries. Rather than running 1,000 SQL “INSERT” queries for 1,000 individual items for example, it’s better to batch those items into a single “INSERT” statement. There are other methods that can be used to improve query performance as well including general query batching in which multiple queries are batched into a single request.

Last night Facebook announced a pretty cool upgrade which is FQL.multiquery. The service enables developers to batch multiple queries into a single request. Additionally, the new service allows for subqueries by reference. As Julie Tung writes on the Facebook developer blog, queries can batched into an associative array. For example:

$queries = {
  "user_stream":"SELECT post_id, actor_id, message FROM stream
    WHERE source_id=UID",
  "actor_info":"SELECT uid, name, pic_square FROM user
    WHERE uid IN (SELECT actor_id FROM #user_stream)"
}

$facebook->api_client->fql_multiquery($queries);

Whether you are looking to reduce the number of FQL calls that you are making, or just looking to create cleaner code, FQL.multiquery is an efficient service for developers. I haven’t had the opportunity to test out the FQL.multiquery service but I’ll most definitely take advantage of this on future apps.

And yes, if you’re wondering that’s an image of the Matrix. That’s what programming in real life looks like.

  Tags:



Recommended Articles


Inside Social Apps 2012 is Less Than Two Weeks Away

Inside Social Apps, held on February 8-9 in San Francisco, is less than two weeks away. This is the third conference on the future of monetization on social and mobile platforms. Leaders from the industry will share their views on today's most formidable challenges affecting social and mobile apps and games in 2012. Inside Social Apps conferences sell out in advance, so take advantage of early registration pricing. Early bird rates end on February 1, so register today.

3 Comments »

  1. Looks more like Oracle. I wouldn't f&ck with Oracle's intellectual property.

    Comment by hwekfjewf — June 17, 2009 @ 1:25 pm

  2. "And yes, if you’re wondering that’s an image of the Matrix. That’s what programming in real life looks like."

    Hahaha, made me laugh. Thanks guys :)

    In all seriousness, this is an excellent addition, props to the FB team.

    Comment by Sebastian — June 17, 2009 @ 1:34 pm

  3. There are alot of fql examples for facebook on coderun website.

    CodeRun is a new online IDE with online examples.

    CodeRun supports variuos languages.

    Comment by Roman — June 21, 2009 @ 6:34 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Send us a Tip

tips@allfacebook.com
[Inside Social Apps 2012]
[AllFacebook Stats: Facebook Analytics for Your Business]
[How can Facebook change your business?]

Upcoming Events

Inside Social Apps

February 8-9, 2012 | San Francisco

Inside Social Apps

Developing & monetizing on social & mobile platforms

Social Gaming Summit

23-24 May, 2012 | Berlin

Social Gaming Summit

Where Gaming Meets the Social Web

AllFacebook Marketing Conference

June 28-29, 2012 | San Francisco

AllFacebook Marketing Conference

Your how-to guide for Facebook marketing.