There is a project where every minute crowns makes a request in the database:

SELECT * FROM `table` WHERE id_param = '153' 

It takes 10 lines, for example, compares the time, if it is in the current time interval +/- 30 seconds, then we do some work.

This all heavily loads the server, although the request is not complicated. What can prompt, what the server would not load? how best to implement it?

If someone came across, tell me)

  • one
    Show explain. 1 request per minute with 10 lines is about nothing. - Shallow
  • 2
    And if the id_param field is numeric, remove the quotes. And also, since you only need records of + -30 seconds right in the query, set such a condition so as not to drag anything extra out of the database - Mike

0