id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE SITES_CATEGORY ref PRIMARY,CATEGORY_SITE_URL CATEGORY_SITE_URL 259 const,const 1 Using where; Using temporary; Using filesort
1 SIMPLE SITES_PRODUCT ALL CATEGORY_ID,RANGE_ID NULL NULL NULL 2725 Using where
1 SIMPLE RIL ALL PRIMARY NULL NULL NULL 423 Using where
1 SIMPLE SITES_RANGE eq_ref PRIMARY,CAT_INDEX PRIMARY 2 toolsonline_central.RIL.RANGE_ID 1 Using where
1 SIMPLE IMAGE eq_ref PRIMARY PRIMARY 4 toolsonline_central.RIL.IMAGE_ID 1 Using where
I split the query into three and then used php do do the sorting and i get a microtime of about half a second. Maybe i should leave it as three queries. I just don't understand why three queries take less time than the one, that's why i wondered if the query is the problem. I have a hunch it is something to do with the or but don't see how i can use joins or anything in this example.
P.S the indexes i have added have improved the speed of the site in general...