Recently done a business project, there is a function of energy efficiency display, through professional processbook software display, each turn on will read the database of each point of the latest value. At the beginning of the use, the speed is also possible, but over time, the discovery of data in the database more and more, resulting in every time the Processbook is opened to wait a long time, more than 10 minutes, spent on the database SELECT statement.
The first time you want to optimize is to optimize the SQL statement, but the actual effect is not obvious.
Suddenly one day, think of a better solution, is to add another memory-like table, which is the latest data on each point. Each time the value of the point is calculated, do two operations, one is to insert the historical data table, on the other hand, update the memory table. So every time the processbook is to go to the memory table to take the value. Sure enough, the software realizes the second open!
This method does not have any technical content, but it is not easy to think that this will be used frequently in future projects.
Project new memory table optimizes software speed