MySQL's index optimizer

Source: Internet
Author: User

1. If multiple columns are indexed, follow the leftmost prefix rule, which refers to the query starting at the leftmost top of the index and not skipping the columns in the index.
2. Do not do any operations on the index (compute, function, (automatic or manual) type conversion), will cause index loss and turn to full table scan.
3. The storage engine cannot use the columns to the right of the range criteria in the index. (the column index after the range condition is missing)
4. Try to use an overlay index (the index-only query (indexed columns and query columns are consistent)), reducing the SELECT *
5. The inability to use the index when MySQL is not equal to (! = or <>) can result in a full table scan.
6 null,isnull also cannot use the index.
7. Like starts with a wildcard ('%0ABC '), the MySQL index fails to become a full table scan
8. String does not add single quote index invalidation
9. Do not use or, the index will fail when connected with it.
Note: You must use the form like '%abc% ' to ensure that the index does not expire? Use the overwrite index.

MySQL's index optimizer

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.