F
Filament3mo ago
Nicole

Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)

I keep getting this error every time I change the pagination range to all. Current filament version is ^3.2.
5 Replies
JJSanders
JJSanders3mo ago
Well if you have a lot of items it could take a lot of time to load all records. So pagination is there for a reason
Nicole
NicoleOP3mo ago
Is there any way to optimize the query?
JJSanders
JJSanders3mo ago
How many records do you have and why would you see all records at once?
36864
368643mo ago
No matter how much you optimize the query, at some point you're just going to have too much data to fit in memory. Just set a maximum page size to something sensible instead of allowing "all"
Malik Tanveer
Malik Tanveer3mo ago
Increase PHP’s memory_limit (e.g. ini_set('memory_limit','256M') or bump it in php.ini) so “All” won’t instantly OOM.
For a sustainable fix, override your resource’s “All” pagination to use Model::cursor() or chunk() streaming, never loading every record at once.

Did you find this page helpful?