lundi 4 avril 2016

Laravel Eloquent Aggregates (Max) return 500 server error

I am using this previously to get the MAX recordID from eloquent model. Unfortunately when the database table row more than 20k then it will return 500 internal server error.

I have checked laravel.log and also apache error log but couldn't get any clue..

After that I try to echo "XXX"; exit(); before each line of my code and found that the exit() stop run after this line.

$lastRecord_sync = \App\TableModel::all()->max('record_id');

Then I tried to change to below and it just working fine.

$lastRecord_sync = DB::table('tms_door_record_raw')->max('record_id');

May I know what is actually the issue here? Does the SQL different from Eloquent Model and DB Query builder?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire