I'm developing an iOS social networking app. I'm currently building "Find Friends" section.
I have a "users" table which is something like this:
-user_id -user_name ... -twitter_id -facebook_id -instagram_id
948913 yagiz 2134421 2132412 4314124312
Now for example when I try to find friends, app does this in the background:
Get the list of whole followings of current user from selected social networking app(Twitter/Facebook/Instagram). Response is a simple array which consists of user ids.
For each Twitter/Facebook/Instagram id run a query that checks if it is in app database.
Currently this works well. But I kinda think that this isn't efficient. Because if the user follows 5K people on Twitter/Facebook/Instagram app runs 5K query.
So I'm asking which is the best way to compare non MySQL list/array/data with MySQL rows?