I have a list with 70 elements.
For Example:
List<Long> dbList = new ArrayList<Long>();
dbList
has 70 records. If I send all the records to a query in MySql it takes a long time. So now I want to send each time 10 elements to database query. So I need to iterate over the list in intervals of 10. How can I do this? Is this a good approach to avoid long time when using IN
.
SQL Query
select model.boothId, model.panchayat.panchayatId
from Table1 model
where model.panchayat.panchayatId in(:locationValues)
and model.publicationDate.publicationDateId in (:publicationDateIdsList)
and model.constituency.id = :id group by model.panchayat.panchayatId
Thanks in advance...