tags:

views:

14

answers:

0

I have a php mysql query like this

$query = "SELECT * FROM articles FORCE INDEX (articleindex) WHERE category='$thiscat' and did>'$thisdid' and mid!='$thismid' and status='1' and group='$thisgroup' and pid>'$thispid' LIMIT 10";

As optimization, I've indexed all the parameters in articleindex and I use force index to force mysql to use the index, supposedly for faster processing.

But it seems that this query is still quite slow and it's causing a jam and maxing out the max mysql connection limit.

Let's discuss how we can improve on such long query.