A statistical table of blood pressure is to be done recently.
For example, the database is this:
UserID Sys Dia PUL time
----------------------------------------------------
User1 88 90 78 time stamp
User2 93 100 90 Time stamp
........
........
.......
--------------------------------------------------
Now you want to average the data for the one-month period. There are three averages:
one is sys,
One is Dia,
One is Pul;
That's what I was thinking. If there is more than one measurement data per day. That requires the average of this data. If there is no measurement data on this day. Just ignore it! It is the average of each day that is counted. The average year is about averaging every month's data! Suddenly felt this complicated. Because it is the average daily data. Back to the client. How to use the database pressure is not too big! Very worried about the number of users. What happened! I beg you to support the big weapon! Thank you!
Reply to discussion (solution)
The database provides an averaging function avg
What you need, just ask the database what to do. Do not worry about whether the database can withstand, so-called personnel do not suspect
Doing a cache, caching for 5 seconds, can reduce the pressure on the database.
This need not worry, you this demand is not so big to MySQL can not do!
You just have to think about how to deal with this business!
This need not worry, you this demand is not so big to MySQL can not do!
You just have to think about how to deal with this business!
3q
Doing a cache, caching for 5 seconds, can reduce the pressure on the database.
What's good about caching?
The database provides an averaging function avg
What you need, just ask the database what to do. Do not worry about whether the database can withstand, so-called personnel do not suspect
Thank you! If you get a form that specializes in keeping average monthly and annual averages in the database. Is that necessary?
Form?
You can actually make a view so that you don't have to calculate when you query
Memcache,
Form?
You can actually make a view so that you don't have to calculate when you query
Need to return the data to the mobile app side! Is this method feasible?
Memcache,
Baidu a bit. It seems powerful.
Of course, for the Martians, they can.
Of course, for the Martians, they can.
Still don't understand how that view was made.
Select AVG (SYS), AVG (DIA), AVG (PUL), substr (sqltime,0,8) as tips from table group by tips