MySQL uses in to query. The collection after in is relatively large. How to optimize SQL?

MySQL,select uses in to query. There are about 5000 items in the collection after in. There are many records in this table. The fields in in query are indexed

.

the original SQL is similar to this
SELECT a FROM table WHERE an in ("1x code 2") and ohterCol = "123"

how to optimize the efficiency of submitting queries

Apr.29,2022

if the content in your in collection exists in this form instead of being queried by other statements
, then all I can think of is to arrange the contents in the collection in an orderly manner, and then increase the size of the innodb_buffer_pool. Can you improve the cache hit rate


5000 pieces of data through other queries?
if possible, it may be more efficient to join this query with the target table.

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-1b37f54-4ed3d.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-1b37f54-4ed3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?