I have the following query:
SELECT *
FROM shop_user_member_spots
WHERE delete_flag = 0
ORDER BY date_spotted desc
LIMIT 10
When run, it takes a few minutes. The table is around 2.5 million rows.
Here is the table (not designed by me but I am able to make some changes):

And finally, here are the indexes (again, not made by me!):

I’ve been attempting to get this query running fast for hours now, to no avail.
Here is the output of EXPLAIN:

Any help / articles are much appreciated.
Based on your query, it seems the index you would want would be on
(delete_flag, date_spotted). You have an index that has the two columns, but theidcolumn is in between them, which would make the index unhelpful in sorting based ondate_spotted. Now whether mysql will use the index based on Zohaib’s answer I can’t say (sorry, I work most often with SQL Server).