laravel4-datatables-package icon indicating copy to clipboard operation
laravel4-datatables-package copied to clipboard

fail on large tables

Open mehdi-zarrin opened this issue 10 years ago • 3 comments

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 .

mehdi-zarrin avatar Jan 31 '15 13:01 mehdi-zarrin

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

gokigoks avatar Apr 21 '15 17:04 gokigoks

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 avatar Apr 21 '15 18:04 Remo

@Remo your right. I guess your queries should be specific? I doubt anyone needs all that 10k rows.

gokigoks avatar Apr 22 '15 02:04 gokigoks