Indexes do not always take effect, such as the following, which will invalidate the index :
- If there is an or in the condition, it will not be used even if there is a conditional index ( which is why the use of or is minimized )
Note: If you want to use or, and you want the index to take effect, you can only index each column in the OR condition
2. For multi-column indexes, not the first part of use, the index is not used
3.like queries are preceded by%
4. If the column type is a string, be sure to use quotation marks in the condition to reference the data, otherwise you will not use the index
Show status like ' handler_read% ';
We can note:
Handler_read_key: The higher the value the better, the higher the number of times the index is queried Handler_read_rnd_next: The higher the value, the less efficient the query
The SQL Server index is invalidated under what circumstances