I have the following query and I know that I will hopefully be working with a large data set to query. I noticed that the rand()
adds significant time to the query and after reading some people say its pretty slow.
Just wondered how I could adjust my query to help speed things up.
SELECT *
FROM users
WHERE instagram_id NOT
IN (
SELECT following
FROM user_follows WHERE
instagram_id = 'insta123'
) AND
instagram_id != 'insta123' AND
current_credits > 0
ORDER BY RAND()
LIMIT 0 ,1