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.

Menu