This is in no way comparable. Although you can get the same data (in some cases) from both their intentions are completely different: FQL is a query language, Graph is an API.
A call to an FQL query if using the new JS SDK is a call to the Graph API ...
You can (and probably should, if you're worried about a real comparison, not theoretical speculation), compare the speed of calls returning the same data, but you have to consider some things:
- The charting API still sucks data filtering conditions
and data aggregation - FQL simply cannot provide you with too many functions needed in modern applications (for example, real-time updates )
- The graphics API has batch capability, which can speed up a lot, it can also be used to call fql.query and fql.multiquery (in a bit cumbersome way).
- API graphs when filtering data with
Field Expansion
Consider the following example from the FQL documentation , a subquery that retrieves all user information for an active user and friends:
SELECT uid, name, pic_square FROM user WHERE uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
This is simply not possible with a single call to the Graph API. (see Update)
Once you determine the desired subset of data, you can choose the appropriate extraction method based on your requirements.
BTW, FQL is much older than the chart, we left it in the direction of FBML (rip) and FBJS (rip)
Update:
Graph API that provides the Batch Query path and indicates the dependencies between operations in the query. For example, the same example as above can be achieved with a single call to the Graph API
POST https://graph.facebook.com/ POST Data: batch=[ { "method": "GET", "name" : "get-friends", "relative_url": "me/friends?fields=id", }, { "method": "GET", "relative_url": "?ids={result=get-friends:$.data.*.id}&fields=id,name,picture" } ]
Update 2:
As of August 30, 2012, the Graph API also supports Field Extension as an additional (very powerful) data retrieval mechanism (including embedded data)