Skip to main content
added show index from results
Source Link

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

##Indexes ##enter image description here

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

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

##Indexes ##enter image description here

deleted 4 characters in body
Source Link
Marco
  • 3.7k
  • 5
  • 24
  • 31

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 consideringinvestigating 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: 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

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 considering 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

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
edited title
Link

Index over multiple fields

Source Link
Loading