Can MySQL IN queries sometimes not trigger indexes?

query statement as follows:
select * from table where index column in (xx,yy,zz,.)
expect it to trigger the index, but sometimes the index cannot be triggered when there are too many elements.
what is the reason for this?

clipboard.png

Nov.29,2021

when there are more elements, is the proportion of data too high?


first make sure whether your aency_phone field is indexed or not. In this way, you will only use the index built on the aency_phone field


table data? Generally speaking, mysql feels that when the ratio of the query to the total amount of data reaches a certain ratio, there is no need to index, because it feels that it is equally fast. You can try force_index to force the use of indexes to see if it will be faster.

Menu