Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 484777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:20:04+00:00 2026-05-13T01:20:04+00:00

The Facebook API has a call $facebook->api_client->friends_getAppUsers(); and that returns the friend ids of

  • 0

The Facebook API has a call $facebook->api_client->friends_getAppUsers(); and that returns the friend ids of a user who is using the app.

Now say I want to select from my db table all the rows that match all those friend ids.

The only way I can think of doing it would be

SELECT * FROM my_table WHERE uid IN(friend1, friend2, friend3, friend4 … friend100);

But wouldn’t this SELECT by prohibitive, performance wise? Is there another way to achieve the same thing? This should be a pretty common thing in facebook apps.

If you look at the Causes app it allows you to see the Causes of your friends. I’m guessing the app would have to pick out all rows from a Causes table that match all the user ids.

Am I going about this the wrong way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:20:04+00:00Added an answer on May 13, 2026 at 1:20 am

    If you don’t have an index on uid, query analyzer will do a table scan on my_table and test each row against the list of friends (think of that as just a cascade of if statements executing on each row). So it’s about as costly as:

    SELECT * FROM my_table;
    

    Now if you create an index on uid, the query analyzer may still do a table scan if the set of friends being tested against is relatively large. If there are relatively few friends in the list, it can do individual lookups by uid. Run some experiments on realistic data sets and see what happens. You can ask MySQL for any query plan by prefixing an EXPLAIN to the query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.