I have the following:
SELECT * FROM autorepair
WHERE zip_code IN (91316,91356,91416,91426,91436)
AND specialty = 'transmission'
ORDER BY ABS(91316 - `zip_code`)
LIMIT 0,10
Indexes:
-zip_code
-specialty
How can I improve the performance on queries like these?
BTW, I'm running this on XAMPP.
Best Answer
Create a compound index as follows:
and drop the single column specialty index