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
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
Is there any way to optimize the query?
How many records do you have and why would you see all records at once?
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"
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.
For a sustainable fix, override your resource’s “All” pagination to use Model::cursor() or chunk() streaming, never loading every record at once.