(1) Index optimization 5
(2) Index optimization 6
(3) Index optimization 7
Query *, add the percent sign to the right, otherwise the index will be invalid
Full table scan before indexing
not indexed
Build index:
indexing
id is the primary key, he can also take it from the primary key
The covering index is about to reach the name, and the index is not invalid
The covering index is about to age, and the index is not invalid
Without * lookups, covering indexes are not invalidated
Use * to find: the number exceeds the index, and the index is invalid
Use multiple fields, but the query field is one more than the created index, and the created index cannot be covered
(4) Index optimization 8
When inputting an integer of 2000, what he needs is a varcher type. The bottom layer implements the conversion from an integer type to a String without double quotes. MySql does an implicit type conversion at the bottom layer.
However, automatic or manual type conversion indexes will fail:
Through the explain analysis, we can see whether these two SQLs use indexes: