Mysql does not use index exceptions

Source: Internet
Author: User
Tags mysql index

Mysql does not use index exceptions
Mysql index today finds a strange thing about mysql: Table Structure:

Table index:
We can see that the ver is of the varchar type and has an index. Search for a piece of data that does not exist:

The type is actually all, And the rows is the whole table. Under what circumstances, no index is used? Search for a piece of data:
Normal !! It takes more than one second to remove explain from the previous type, and only 0.0 for the next type. This indicates that the previous type does not use indexes !! This is a wool situation! I think it is still helpful for indexing. No answer was found in the Manual. A burst of inspiration:
You can scale up 123 with a single lead. This is a good decision !!! Why? I did not find an official answer, but according to my experience, it is assumed that the string is converted into a number by comparing it with a number, this may disturb the index and lead to another conjecture. What if the data is a number and a string is searched? After my tests, I found that indexes will still be used. This is more in line with my previous conjecture, because the search condition is a string, but the search condition is converted to the index number, the index is not disturbed.

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.