I can't see the point in the query that you are doing; your returning an array of id
that exist in the User table from $idList
?
With that said, I would "stream" the request by breaking up $idList
into batches of say 1000 ids, looping over those batches and running the query on each, appending the result to $userIdLists
upon each iteration. Increase the batch size until you get the least amount of batches possible.
foreach (array_chunk($idList, 1000) as $idListBatch) {
...
}
There are better ways of doing this, but off the top of my head this is the one I can think of.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community