I have a table with ~40 million entries and I have an index for most of my fields. All my queries are optimized, except for one, which gets called a couple times per second and uses most of the fields. Now I'm investigating on how to optimize this query, do I:
- create an index over all fields?
- create an index over all fields and remove the individual indexes?
If I have an index over all fields, would I even need the individual indexes?
This is the query:
SELECT count(*) as rang_pos
FROM results
WHERE results.created >= DATE_SUB(NOW(),INTERVAL 24 HOUR)
AND results.speedtest_id = 1
AND results.checked = 1
AND results.typing_mode = 1
AND results.keystrokes <= 500