Under what circumstances will indexes become invalid ?, When the index is invalid ?. Under what circumstances will indexes become invalid ?, When the index is invalid? The index does not always take effect. for example, in the following situations, the index will become invalid: Note: If you want to use or, in which cases do you want to invalidate the index ?, When the index is invalid?
The index does not always take effect, for exampleIndex failure may occur in the following situations::
Note: to use or and make the index take effect, you must add an index to each column in the or condition.
2. if multiple-column indexes are not the first part, they are not used.
3. like queries start with %
4. if the column type is string, you must reference the data in quotation marks in the condition. otherwise, no index is used.
5. if mysql estimates that using full table scan is faster than using indexes, no indexes will be used.
In addition, view the index usage
Show status like 'handler _ read % ';
Note:
Handler_read_key: the higher the value, the better. the higher the value indicates the number of handler_read_rnd_next queries using the index. the higher the value, the less efficient the query.
Why ?, When the index is invalid? The index does not always take effect, for example, the following situations will lead to index failure: Note: to use or, you want to make...