If the table defines a varchar field and the number is passed in, an implicit conversion occurs.
1. Table DDL
2, the SQL to pass int
3. String-Passed SQL
Take a closer look at the table structure, the field type of RID:
When the user comes in int, there is an implicit conversion problem, and implicit conversions cause a full table scan.
Change the input to a string type and execute the plan as follows, and it will be quick.
In addition, it is important to note that:
0001 of the numeric type is equivalent to 1
0001 and 1 of strings are not equivalent
Second, if the table defines an int field, the string is passed in, no implicit conversions occur within the range of int, and if the range is out of scope and the size of the comparison (' $ ' compared to the string type) is implicitly converted.
1. Table DDL
2. sql that does not exceed the range string
3, not over-range data-borne SQL
4. SQL out-of-range string
5, out-of-range data-passing SQL
About MySQL implicit conversions