Built table SQL:
index failure should avoid
the full value of my favorite match:
the best left-prefix rule : If a multi-column index, the most left-prefix to comply with the law, referring to the query from the leftmost in the forefront of the beginning of the index and does not skip index columns. (Take the lead in Big Brother can not die, the middle brother can not be broken)
not in the index column do anything (computing, function (automatic or manual) type conversion), will lead to failure while the index turned full table scan (not counting the index column)
Storage Engine You can not use an index range condition rightmost column (index full fail after a range)
to make use of a covering index (only access to the index query (indexed columns and query uniform)), reduction SELECT *
MySQL using the not equal (! = or < >) can not be used when the index will lead to a full table scan
is null, is not null can not use an index
like to begin with wildcard characters ( '% abc ...') mysql index failed to fulfill the operation becomes a table scan (like the right percentage increase )
problem: index (using a covering index avoid full table scan) when the solution is not used like '% string%'
after CREATE iNDEX idx_user_nameAge ON tbl_user (NAME, age) to create an index
number of the correct order to be effective
string without single quotes index failed (string in quotation marks)
less or, the index will fail when it is used to connect
a small sum
optimization summary formulas:
MySQL optimization index (index How to Avoid Failure)
Guess you like
Origin blog.csdn.net/qq_39885372/article/details/104187557
Recommended
Ranking