laravel4-datatables-package
laravel4-datatables-package copied to clipboard
fail on large tables
Hi,
i have the below code in my controller :
$users = User::select(['id' , 'username', 'first_name', 'last_name', 'email']);
return Datatables::of($users)->make(true);
it's works fine for 5 records :) but when i insert 100000 records with faker i'm geeting memory PHP Fatal error: Allowed memory size of 134217728 bytes exhausted
.
thanks .
php has max_memory capacity which can be changed with the php INI. But you can change it on a running php script with this
ini_set('memory_limit','16M');
increase at your own dispense
that's the wrong approach, I'm quite sure @mehdi-zarrin meant that this package should never consume more memory unless you display all records at one. With a server side pagination you shouldn't have to increase your memory limit like that, it should fetch the rows with a limit and only return those that are actually displayed..
@Remo your right. I guess your queries should be specific? I doubt anyone needs all that 10k rows.