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.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3812b-40670.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3812b-40670.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?