The Facebook API includes a call $facebook->api_client->friends_getAppUsers() which returns the friend ids of the user who's while using application.

Now say I wish to choose from the db table all of the rows that match all individuals friend ids.

The only method I'm able to think about doing it might be

Choose * From the_table WHERE uid IN(friend1, friend2, friend3, friend4 ... friend100)

But wouldn't this Choose by prohibitive, performance smart? Can there be a different way to attain the same factor? This ought to be quite a common factor in facebook applications.

Should you consider the Causes application it enables you to view what causes your buddies. I am speculating the application would need to choose all rows from the Causes table that match all of the user ids.

Shall We Be Held carrying out this the wrong manner?

Without having a catalog on uid, query analyzer is going to do a table scan on my smalldesk and test each row from the listing of buddies (think about that as only a cascade of if claims performing on each row). Therefore it is about as pricey as:

SELECT * FROM my_table;

If you create a catalog on uid, the query analyzer can always perform a table scan when the group of buddies being examined against is comparatively large. If you will find relatively couple of buddies within the list, it may do individual searches by uid. Run some experiments on realistic data sets and find out what goes on. You are able to request MySQL for just about any query plan by prefixing an EXPLAIN towards the query.