Thinking about database optimization

1. For the business scenario of client-side regular query, you can consider putting it on the server to query the results at a time and then notify each customer. For example, each client has a timeout display statement, a message view statement, etc.

2. In actual development, if you encounter incompatibility with the operating system and IE version, you can consider more shell compatibility mode. Provide use after encapsulating and implementing by yourself.

3. Many SQL statements involved in the system are written in the code, which leads to the need to modify the corresponding business service program every time a field is added or a statement is modified, which has a large impact and high development and maintenance costs.

4. When the specific SQL statement is complex, it may be caused by the unreasonable table design. Some setting logic of the table structure can be further optimized according to the business scenario. So as to optimize the corresponding sentence.

5. It is recommended to use paging query logic and corresponding controls to achieve it. The user unconsciously switches to the next page for display and processing.

6. Other content:
(1) Multiple business function points, mixed together, use the same SQL statement to write, resulting in many query fields and many related tables.
(2) For the same business function point, different hospitals will have slightly different query sentences, which leads to the continuous increase of fields and inconvenience in maintenance.

Two types of transformation are recommended:
(1) For the reason (1), each SQL statement is used to confirm whether there are multiple business function points. If this situation exists, it needs to be split, and the query conditions are reorganized for each business function point. , Show fields, write multiple SQL statements.
(2) For the reason (2), the following modifications need to be made to the query requirements:
(a) It is necessary to find a data layer framework similar to MYBATIS in JAVA under C++, and put the statement in the configuration file for writing. In this way, the code does not need to be changed, and different SQL statements can be configured for the same business function point for each hospital, reducing the difficulty of maintenance.
(B) In addition to configuring different SQL statements for the same function point, the title of the query result must be dynamically obtained from the configuration, so that the query result can be configured.
(3) Paging transformation:
(1) Develop a unified paging method in the background, usually the framework will provide at least two interfaces for query by queryByPage (paging query) and query (general query, no paging), of course, according to different input and output parameters Participate, there will be multiple such query methods.
(2) The front desk provides an independent paging control, or a table control with paging function, and at the same time determines the interface parameters involved in paging with the background service, such as the total number of records, the number of records per page, etc., to facilitate the determination of the parameters of the background paging method .

Guess you like

Origin blog.csdn.net/weixin_39597541/article/details/104516746