dimanche 25 janvier 2015

MYSQL - Optimise query to proceed as fast as possible

im forcing now performance problems in my service due high and still growing traffic. this is my sql query



SELECT * FROM $db1 WHERE userid!='$userid' AND media NOT IN (SELECT media FROM $db2 WHERE uid='$userid') ORDER BY active ASC LIMIT 60


This is very poorly optimised. It was working good when db2 has only few thousand rows. But now i've around 100k and i takes even 5-10s to get response from api server. Im worried because now im getting more users each day and performance keep getting worse. Please help me optimise this query, im not the best in sql.


Aucun commentaire:

Enregistrer un commentaire