Answer the question
In order to leave comments, you need to log in
How to create an algorithm for collecting and displaying game server statistics?
I write game server monitoring. Every minute I get information about servers. Interested in issuing information to the user. It is necessary to build graphs for the month, for the day and for the hour. What is the best way to do all this?
Now for the day and hour I choose this:
SELECT * FROM `tbl` WHERE `date` > NOW() - INTERVAL 1 DAY GROUP BY DATE_FORMAT(`date`,'%y%j%H');
SELECT * FROM `tbl` WHERE `date` > NOW() - INTERVAL 1 HOUR GROUP BY DATE_FORMAT(`date`,'%y%j%H%i');
Answer the question
In order to leave comments, you need to log in
Can be separate tables - in one on hours.
In another, after a day (by krone, for example), make a record - calculations of the average daily
. In another, similarly for months.
Statistics do not change retroactively, so it will not need to be recalculated every time.
You can only choose from the corresponding tables, if necessary, and group them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question