Mysql Index Establishment need to note the following details _mysql

Source: Internet
Author: User
1. The timing of indexing: If a field in a table appears in Select, Filter, and sort criteria, it is worthwhile to index the field.

2. For a vague query like '%xxx ', a normal index is not satisfied and needs to be set up for Full-text indexing.

3. For multiple conditions, such as: "... where a=xxx and b=yyy", "... where a=xxx order by B", "... where a=xxx GROUP by B". You need to use a composite index. However, a composite index can only be used in a SQL statement that satisfies the "leftmost prefix" condition. Combined indexes have some side effects, such as the size of the index may be larger than the data itself, because there are many combination entries for the combined index. So in practical applications, to be tailored, using slow query analysis tool analysis.

4. Open the index cache, find the index directly in memory, no more disk.

5. Indexing is a cost, and when the update, DELETE statements are executed, the index is updated, which consumes more time. You can use the Mysqlreport report to understand the percentages of the Select, Update, delete, INSERT, and replace statements.

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.