A question about MySQL in Operation index optimization

Source: Internet
Author: User

There is index (A,B,C)-the combined Index multi-field is ordered and is a complete btree index.
    • The following criteria can be used on the combined index query:
      • A>5
      • A=5 and B>6
      • A=5 and B=6 and c=7
      • A=5 and B in (2,3) and c>5
    • The following conditions will not work with the combined index query:
      • b>5--query condition does not contain the first column field of the combined index
      • B=6 and c=7--query condition does not contain the first column field of the combined index
    • The following conditions will be able to query with the upper part of the composite Index:
      • A>5 and b=2--when a range query uses the first column, the query condition can only use the first column
      • A=5 and B>6 and c=2--range queries use the second column, the query condition can only use the first two columns

    • A=5 and B in (2,3) and c>5, all fields to the index are used. What is the principle? is automatic optimization split into a=5 and b=2 and c>5 or a=5 b=3 and c>5 two SQL? When the number of in is reached, the index can only be used in a-B column, but not in column C?

A question about MySQL in Operation index optimization

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.