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:



Comments (3 Responses)

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

“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.

There are alot of fql examples for facebook on coderun website.
CodeRun is a new online IDE with online examples.
CodeRun supports variuos languages.

Leave a comment


 

Send us a Tip tips@allfacebook.com
Top developers Also View Top Applications
200,811,319
+ 1,184,786 (0.59%)
FarmVille
65,950,317 MAU
Café World
28,917,504 MAU
59,471,991
-95,156 (-0.16%)
Pet Society
21,770,968 MAU
Restaurant City
17,742,810 MAU
40,288,802
+ 245,761 (0.61%)
Facebook for iPhone
17,855,256 MAU
Static FBML
11,958,636 MAU
As of Nov 21 09 3:51AM