开发者

Facebook - max number of parameters in “IN” clause?

In Facebook query language(FQL), you can specify an IN clause, like:

SELECT uid1, uid2 FROM friend 开发者_如何转开发WHERE uid1 IN (1000, 1001, 1002)

Does anyone know what's the maximum number of parameters you can pass into IN?


I think the maximum result set size is 5000


It may seem like an odd number (so perhaps I miss counted, but it's close ~1), but I can not seem to query more than 73 IN items. This is my query:

SELECT object_id, metric, value
FROM insights
WHERE object_id IN ( ~73 PAGE IDS HERE~ )
AND metric='page_fans'
AND end_time=end_time_date('2011-06-04')
AND period=period('lifetime')

This is using the JavaSCript FB.api() call.


Not sure if there is an undocumented limit or it might be an issue of facebook fql server timeout.

You should check if there is a error 500 returned from FB web server which might indicate you are passing a too long GET statement (see Facebook query language - long query)

I realized my get was too long so instead of putting many numbers in the IN statement, i put a sub-query there that fetches those numbers from FB FQL - but unfortunately it looks like FB couldn't handle the query and returned an 'unknown error' in the JSON which really doesn't help us understand the problem.


There shoud not be a maximum number of parameters as there isnt in SQL IN as far as I know.
http://www.sql-tutorial.net/SQL-IN.asp

just dont use more parameters than you have values for the function to check because you will not get any results (dont know if it will give away an error as I never tried to).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜