Home  >  Article  >  Backend Development  >  How to implement statistics on the number of tasks this month and this week when the amount of data is large?

How to implement statistics on the number of tasks this month and this week when the amount of data is large?

WBOY
WBOYOriginal
2016-08-18 09:16:071637browse

Do I need to create two tables for this month and this week to record the number of tasks per month and week? Does anyone know, please help.

Reply content:

Do I need to create two tables for this month and this week to record the number of tasks per month and week? Does anyone know, please help.

Same question, if there are multiple tables, they need to be operated asynchronously, and the data of each table needs to be added and updated. Don’t know if it’s appropriate

How big the amount of data is? I think it can be considered in the secondary business table primary key ID.
If we maintain two more tables, when will they be updated? Maintenance of statistical tables will affect business processes.

1. Write the data of the last month to the Redis List
2. Write a script that runs automatically in the early morning, remove the first element in the list, and insert the day’s tasks to the end of the list
3. The above scenario Suitable for tasks in the last month and week

Portal

If it is a hard-written month instead of the last 30 days, when writing the table, index the year/month/week number

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn