MySQL index length interpretation and a special case of not using indexes

Source: Internet
Author: User
Tags mysql index

If the two table is associated with a field that is not set in the table structure, it cannot be used even if the index is set.

For details, please refer to:

Https://yq.aliyun.com/articles/69138?spm=5176.100239.bloglist.185.xQpesw

For MySQL explain, the Key_len field is calculated as follows:

VARCHR (10) Variable length field and allow NULL = ten * (character set:utf8=3,gbk=2,latin1=1) +1 (NULL) +2 (variable-length field)
VARCHR (10) Variable-length field and no null = +2 (character set:utf8=3,gbk=2,latin1=1) (variable-length field)

char (10) Fixed field and allow NULL = ten * (character set:utf8=3,gbk=2,latin1=1) +1 (NULL)
char (10) Fixed field and does not allow NULL = ten * (character set:utf8=3,gbk=2,latin1=1)

Detailed reference: http://www.cnblogs.com/gomysql/p/4004244.html

MySQL index length interpretation and a special case of not using indexes

Related Article

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.