Laravel数据表 - 最大执行时间超过

时间:2017-03-31 10:52:25

标签: php mysql laravel-5 datatables

我使用laravel datatables serverside从4个表中获取数据并显示它们。 我在routes / web.php上的代码是:

    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();
    }
]);

问题是主表(Table1)有超过20.000条记录,并且会有更多。我超过了最大执行时间。有没有办法优化查询或以某种方式显示数据表中的结果?

0 个答案:

没有答案