Common Database Optimization methods: Index (database), cache, sub-table, sub-Library, SQL optimization. index: Creating an index typically has the following two purposes: maintain the uniqueness of the indexed columns and provide a strategy to quickly access the data in the table. 95% of database performance problems can be solved by indexing technology. Indexes can help improve retrieval performance, but too many or improper indexes can cause system inefficiencies. Because the user adds an index to the table, the database will do more work. Too many indexes can even cause index fragmentation. Cache: Hibernate,spring3 has a cache module table: to generate a large amount of data for each time period, consider using a certain strategy to store the data in multiple data tables. Sub-Library: It is the system according to the characteristics of the module distribution to different data, to improve the overall load capacity of the system. SQL optimizations: 1.in and not in are also used with caution, because in causes the system to not use the index and can only search the data in the table directly. 2. When judging the true or false is, if with and OR OR: ( when there is "where condition 1 and Condition 2", the database executes the right statement first ) and try to put the false to the right (a false is false) or as far as possible to put the true to the right (one is true) 3. Should try to Avoid expression operations on fields in the WHERE clause, which causes the engine to discard full table scans using the index 4. Use View acceleration query reprinted from: http://blog.sina.com.cn/s/blog_76c0a1c50101d0gq.html
The optimization method of database