In my web application, I want to find out which of a user's friends on Twitter are already existing on the system... Currently what I am doing is getting the list of Twitter IDs the user is following (Twitter API returns the IDs 5000 at a time), and doing:
SELECT userId FROM users WHERE userId IN (COMMA_SEPARATED_LIST_OF_IDs);
I don't feel comfortable about this query, because as the users table grows, this might prove to be a bottle neck. I don't want to optimize prematurely either, so is there any other way I should be doing this?
Update: I am using MySQL.