Home>Article>Database> Under what circumstances will the index fail?

Under what circumstances will the index fail?

清浅
清浅 Original
2019-04-29 13:21:19 37474browse

The situations where the index fails are: 1. When calculating the column or using a function; 2. When using the reverse operation or link operation; 3. When using or in the where statement, if a column is not index, then other columns will be invalid.

Under what circumstances will the index fail?

【Recommended course:MySQL Tutorial

Under what circumstances do you need to use an index?

(1) Columns are often used in where conditions

(2) There are a large number of null values in the column

(3) The table has hardly been modified

(4) The amount of data is very large, only 2-4% of the data is selected

Under what circumstances will the index fail?

Under what circumstances will the index become invalid?

(1) If the column is calculated or a function is used, the index of the column will become invalid

(2) Mismatching the data type will cause index failure

(3) IS NULL or IS NOT NULL is used in the where statement, which will cause index failure

(4) Reverse operation is used, which The index will not work

(5) If the link operation is used, the index will not work

(6) When using OR in WHERE, if one column does not have an index, then the other columns The index will not work

Summary: The above is the entire content of this article, I hope it will be helpful to everyone.

The above is the detailed content of Under what circumstances will the index fail?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn