Home >Database >Mysql Tutorial >Why does mysql show that it is invalid?

Why does mysql show that it is invalid?

藏色散人
藏色散人Original
2020-11-03 10:37:422060browse

Mysql displays invalid reasons and solutions: 1. Add indexes to all columns in the or condition; 2. Like queries starting with "%" cannot use indexes; 3. Implicit conversion will cause The index is invalid; 4. The query condition uses a function on the index list or uses operators such as "+-" on the index column.

Why does mysql show that it is invalid?

Recommended: "mysql video tutorial"

Several situations of mysql failure

1 . If there is or in the query condition, even if the query condition contains an index, it will be invalid. If you want to use or, but do not want the index to be invalid, you can only add indexes to all columns in the or condition

2. Like queries do not use indexes at the beginning of 1%,

3. Implicit conversion will invalidate the index

For example, if the field type is varchar and indexed, but the type passed is a numeric type, this The index will be invalid. On the contrary, if the field type is int and the value passed is varchar, it will not affect the index.

4. Query conditions use functions on the index list, or use operators such as +- on the index column. , will also be invalid

5. To be continued. . . .

The above is the detailed content of Why does mysql show that it is invalid?. 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