vendredi 31 mars 2017

Laravel datatables - Max execution time exceeded

i use laravel datatables serverside to get data from 4 tables and display them. The code that i have on routes/web.php is:

    Route::get('/serverSideSymv', [
    'as'   => 'serverSideSymv',
    'uses' => function () {
        $symv = App\Symvolaia::Select('table1.*')
            ->join('table2', 'table1.field1', '=', 'table2.id')
            ->join('table3', 'table1.field2', '=', 'table3.id')
            ->leftJoin('table4', function($join)
           {
               $join->on('table1.field3', '=', 'table4.field5');
               $join->on('table1.field6', '=', 'table4.field7');
           })
            ->select('table1.id','table2.field1','table1.field2','table1.field3','table1.field4','table3.field5','table1.field6','table1.field7','table1.field8','table4.field9','table1.field10','table1.field11','table1.field12','table1.field13','table1.field14','table2.field15');
        return Datatables::of($symv)
            ->editColumn('field5', function($data) {
                return Illuminate\Support\Facades\Crypt::decrypt($data->field5);
            })
            ->make();
    }
]);

The issue is that the main table (Table1) has more than 20.000 records and will have much more. I get max execution time exceeded. Is there any way to optimize the query or somehow show the results in datatables?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ogx8Yx
via IFTTT

Aucun commentaire:

Enregistrer un commentaire