mysql optimization - mysql 5.7 not in != The index is valid, why? Updated?
过去多啦不再A梦
过去多啦不再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

过去多啦不再A梦
过去多啦不再A梦

reply all(1)
淡淡烟草味

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!