Php order data analysis problems

Source: Internet
Author: User
With the increase of time, more and more data will be in the order table. Therefore, you need to analyze the data for one month, one quarter, or even nearly one year, such as the refund rate and payment rate, and related parameters of the product associated with the order, but the consequence of such a real-time calculation is either timeout or inner... with the increase of time, more and more data will be in the order table. Therefore, you need to analyze the data for one month, one quarter, or even nearly one year, such as the refund rate and payment rate, related parameters such as products associated with orders, but the consequence of such a real-time computing is either timeout or memory overflow. to solve this problem, use the php solution.

Reply content:

With the increase of time, more and more data will be in the order table. Therefore, you need to analyze the data for one month, one quarter, or even nearly one year, such as the refund rate and payment rate, related parameters such as products associated with orders, but the consequence of such a real-time computing is either timeout or memory overflow. to solve this problem, use the php solution.

For the data before the current day, you can collect and process data regularly every day, store the data to the database, and change the space for time. in this way, real-time data only needs to be queried on the current day, and the efficiency will be much higher, this will greatly reduce the pressure on the server. you can also cache it to prevent the pressure caused by frequent refresh.

This problem is broad and essentially irrelevant to the language, but we can start with these two points first.

  1. Set up an offline database and check your queries in the offline database. do not go to the primary database for query (whether data is exported or the master database depends on your actual situation)

  2. For some frequently-needed data, design one or more tables for data analysis and run them once at a fixed time according to the required dimension. The historical data only needs to run once, you only need to run the new data for analysis.

Further, we need to introduce some other tools (such as ES, Hadoop, and so on), and even re-design the form of your data analysis-related products.

You can create a summary table and regularly write the statistical information into the summary table. then, you can directly query the summary table. the statistical information is in the form of monthly or quarterly.

  • Run scripts in cli mode. do not run fpm.

  • Use the yield keyword in the loop without generating any intermediate variable.

Related Article

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.