I want to get the count of rows that has sec_id and the ref_id should be present in the list say ref_list.
The size of ref_list is around 300.
The size of table is around 70,000.
I am currently using this technique to get the count of rows satisfying the above condition.
SELECT count(*) FROM table where sec_id=? and ref_id IN (?,?,...,?)
It is taking in between 20ms to 30ms to execute.
But this query will be executed for around 1200+ times, so the overall time is becoming around 45s to 50s to execute.
Is there any other way that i can reform the above query so that it may take less time?
The table is indexed with id as primary key and
ref_id of key type as multiple
Database -> MySQL