title: Running a large IN query (searching for users with an ID list) on GAE
body: <p>I am trying to detect, after a user registers, which friends from Facebook have already registered for my service. My current implementation is very CPU intensive:</p>
  
  <pre><code>for eachFriend in facebookFriends:
    friendUser = User.get_by_key_name(eachFriend['id'])
    if friendUser:
      friendUsers.append(friendUser)
  </code></pre>
  
  <p>I tried optimizing the query by using the IN operator:</p>
  
  <pre><code> users = User.all().filter('id IN', idList).fetch(10) # the idList is the list of IDs for a users facebook friends
  </code></pre>
  
  <p>This method fails as the maximum subqueries of the IN operator is 30.</p>
  
  <p>Any tips?</p>