mysql index is lost --- index failure caused by field type conversion

 

 

 

The test_2 table has three fields in bcd, varchar type, which is a joint index of the three fields, but the first query is ALL, because the string does not add single quotation marks, and the implicit type conversion causes the index to fail

 

  • The function makes the index invalid.
    In the above example, we found that this is the main reason for the index failure, and the field type has been converted.

  • String without single quotes (implicit type conversion; production felony) causes the index to become invalid

 

Do not do any operation (calculation, function, (automatic or manual) type conversion) on the index column, it will cause the index to fail and turn to the full table scan!

Guess you like

Origin blog.csdn.net/liuming690452074/article/details/113809921