The optimization method of database

Source: Internet
Author: User
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

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.