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.
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)
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.