mysql optimization - mysql 5.7 not in != The index is valid, why? Updated?
过去多啦不再A梦2017-05-18 10:46:28
0
1
1286
Why did I use not in != on mysql 5.7 today to use the index? I read many articles saying that the index will become invalid. Is it because mysql has been updated? Now those query conditions will cause index failure
not in or != will cause index failure, which is not absolute. It will be invalid in scenarios where the data is relatively uniform. However, if the fields with seriously uneven business data are indexed, it will not necessarily be invalid. MySQL will make its own judgment, and it is not absolute. Determine not to use an index. For example, the gender column of table A has 10,000 male entries and 20 female entries. When sex!='male', you can use the index. Similarly, if you have sex='male', you will not use the index. MySQL will choose the best one. Search method
not in or != will cause index failure, which is not absolute. It will be invalid in scenarios where the data is relatively uniform. However, if the fields with seriously uneven business data are indexed, it will not necessarily be invalid. MySQL will make its own judgment, and it is not absolute. Determine not to use an index. For example, the gender column of table A has 10,000 male entries and 20 female entries. When sex!='male', you can use the index. Similarly, if you have sex='male', you will not use the index. MySQL will choose the best one. Search method