So i have a rather big query which searched though 6k members and 3k websites this use to be good on website start up but now the site is getting huge the page which does this query has started to lag just looking for suggestions on how i could speed it up
$stmt212 = $db->prepare('SELECT *
FROM websites w
LEFT JOIN users u ON u.username = w.owner
WHERE u.coins >= ?
ORDER BY RAND()
LIMIT 1');
$stmt212->execute( array('1') ) ;
$row212 = $stmt212->fetch();
The users have "coins" on my website and items they earn coins and then there item gets viewed so what im doing above is grabbing a user where there coins is more than 1 and who has a item