I have an eloquent carry that has to filter through 30+ million records. Everything goes well speed wise.. but whenever i try to do a nested filter query it will keep loading and loading until it crashes...
This is the query:
Balance::orderBy('id', 'asc')->maincheck()->simplePaginate(300);
this below is the same query but without the "simplePaginate" behind it
SELECT *
FROM `balances`
WHERE ((
`balances`.`balanceable_type` = ?
AND EXISTS(SELECT *
FROM `balance_accounts`
WHERE `balances`.`balanceable_id` = `balance_accounts`.`id`
AND `maincheck` = ?)
))
ORDER BY `id` ASC
Does someone have an idea on how to fix this with an other way. I have tried using chunks but it sucks. I have to use eloquent.