Searching for users email contacts in db
I'm busying building a tool for my site where i get a users email contacts which i then want to match with email addresses of users in my database.
This is all fine, but my question is that if a user has hundreds of contacts, and im searching through thousands of users, isn't this going to be a very intensive query?
Should i be doing this some other way or limit the number of users that i search for or is this not a problem? I have set the 'email' field as unique, but should i be doing some other kind of indexing?
SELECT userid FROM users WHERE email IN (" . implode(",",$contacts) . ")