How to make statistics on such data?

Source: Internet
Author: User
I have a clerk management system with a clerk 1 W and a table of members. the clerk has a recommendation mechanism (the clerk has almost unlimited recommendations ). There is also a clerk's sales performance table, member_sales. every clerk sells a piece of data to member_sales. Now I want to count a clerk's management system every day... I have a clerk's management system, clerk's 1 W, Table members, clerk's recommendation mechanism (clerk's almost unlimited recommendation ).
There is also a clerk's sales performance table, member_sales. every clerk sells a piece of data to member_sales.
Now I want to count the daily turnover of a clerk and all his employees. if I meet my performance requirements, I will give him a bonus.
Currently, there is not much data. I opened five crontabs to count 2000 shop assistants every hour and finish the work in five hours.
But I am afraid that this stupid method will not work when there are too many shop assistants. what should I do?

Reply content:

I have a clerk management system with a clerk 1 W and a table of members. the clerk has a recommendation mechanism (the clerk has almost unlimited recommendations ).
There is also a clerk's sales performance table, member_sales. every clerk sells a piece of data to member_sales.
Now I want to count the daily turnover of a clerk and all his employees. if I meet my performance requirements, I will give him a bonus.
Currently, there is not much data. I opened five crontabs to count 2000 shop assistants every hour and finish the work in five hours.
But I am afraid that this stupid method will not work when there are too many shop assistants. what should I do?

Use databases. mysql is simple enough.

If you use a database to collect statistics on the data, you may be able to analyze the data later.

Just run once every morning. it's unnecessary to run once every hour.

Is the database used,sqlIt is impossible to query 2000 in an hour,crontabWhat is the task?

This type of relational database is appropriate

The SQL statement you are counting should be problematic. is it embedded with the loop select statement.

Redo it. There is a problem with the clerk's tree structure design, and the statistics logic is not correct, so the time is too long, not dozens of words can be understood.
The clerk must be in a tree structure, and his/her sales performance is the sum of his/her own sales performance and all its sub-nodes.
In addition, the member_sales table should have two fields: sales date and sales time. the sales date is used for statistics, but cannot be converted by formatting the sales time.
For the tree structure, see unlimited classification.

Paste all the SQL and programs for your scheduled task

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.