What is the best way to get list of photos with me and a friend tagged in them?

旧城冷巷雨未停 提交于 2020-01-01 17:27:09

问题


I'm doing this fql:

SELECT object_id, pid, src_big, src_big_height, src_big_width, src, src_height, src_width 
FROM photo 
WHERE pid IN (SELECT pid FROM photo_tag WHERE subject= [me_uid]) AND pid IN (SELECT pid FROM photo_tag WHERE subject= [friend_uid] ) limit 0, 20

This works fine until I use 2 users ids who have thousands of photos with hundreds of them tagged with both uids.

In this scenario, FB returns a 500 error: "Error loading script", error code 1

I need to incrementally retrieve data as a user pages down. Getting All photos/tags for both users and then comparing the 2 full lists is not acceptable for this app.

Any thoughts?


回答1:


Maybe optimize it like so:

SELECT object_id
  FROM photo 
 WHERE pid IN (SELECT pid 
                 FROM photo_tag 
                WHERE subject = [me_uid] AND pid IN (SELECT pid 
                                                       FROM photo_tag 
                                                      WHERE subject [friend_uid]) LIMIT 0, 20)  

hope this helps



来源:https://stackoverflow.com/questions/7523225/what-is-the-best-way-to-get-list-of-photos-with-me-and-a-friend-tagged-in-them

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!