我有这个疑问:Laravel 5.2 - 更新以前的查询
Sendqueue::select()
->where('userID', Session::get('uid'))
->where('campaign', $id)
->where('status', 'pending')
->update(array(
'status' => 'stopped',
));
的问题是,它要经过做更新的记录量使得它需要大约15分钟左右完成。
我想分解它,所以选择和更新查询是单独的实体。有点像这样:
$pending = Sendqueue::select()
->where('userID', Session::get('uid'))
->where('campaign', $id)
->where('status', 'pending')
->get();
$pending->update(array(
'status' => 'stopped',
));
我该怎么做呢?还是有更简单的方法?
谢谢!
任何人都可以解释为什么第一个查询是次优运行? –