FQL is hard. Making sure it returns all possible results is one of the most mystifying exercises I can think of. Consider these queries, that only differ by limit and offset, and their returned results:
SELECT caption FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner = me())
AND 0 < created AND created < 1299952078 LIMIT 400 OFFSET 0
Returns 400 results. Okay, cool.
SELECT caption FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner = me())
AND 0 < created AND created < 1299952078 LIMIT 400 OFFSET 400
Returns 0 results. Hm, maybe I only have exactly 400 photos. Let's just confirm that:
SELECT caption FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner = me())
AND 0 < created AND created < 1299952078 LIMIT 500 OFFSET 0
Returns 357 results. Wat. Where's the other 43 results go? Let me lower the limit and page through:
SELECT caption FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner = me())
AND 0 < created AND created < 1299952078 LIMIT 300 OFFSET 300
Returns 0 results??? Oh c'mon.
Can anyone explain that? I'm pulling my hair out.
Commenting further on @user15 source: https://developers.facebook.com/blog/post/478/
Explanation:
Specifically applied to your example:
This means that at some disjointed data (#3 in the picture) you were able to get 400 total results.
This comes right from their text:
Thus it looks like with limit you will get #3 in the graph, but when using offset its possible you will end up with something like #2; which means your offset may put you in one of the red areas of #2, meaning the post is invisible to the user and will not be in your data set (0 returned results).
From their text:
See my answer to your second query
Solution:
As per my comment on your question of how to simplify your original query:
This query is saying check for all photos, in all of my albums, where the created date is before some time (timestamp). Is this correct?
Two possible solutions I could see you doing:
Check to see what permission restrictions there are on those photos that are getting removed from the result set, you might need to rework your query to include these:
From: https://developers.facebook.com/docs/reference/fql/photo
This is the one I think will work the best for you. You might need to pick a sufficiently low limit like 20 or 50, and adjust the timestamp around your query such as:
Previous:
Next:
Let me know if either of these work for you. Please note I made up the second timestamp, you will have to figure that out.