F
Filament2mo ago
Eskie

Bulk Best Practices(i guess)

When you do a bulk select on the table and you have a function to like update status.. Let say you select a millions of records.. how are you going to handle it? are you going to use Queue or is there other way?
4 Replies
Dan Harrin
Dan Harrin2mo ago
v3 or v4? and does your model have an observer on it?
Eskie
EskieOP2mo ago
either.. just want to know if there are any goods ways on handling millions of data using bulk.. right now i am using queue to update the records but the problem is that the users will wonder why it isn't real time..
Dennis Koch
Dennis Koch2mo ago
Depends on the Action that you are executing. In v4 we have new options. That's why Dan asked. You could use ->fetchSelectedRecords(false) and bulk update them via the Database. So then you can do a
YourModel::query()
->whereIn($records)
->update(['status' => 'new status']);
YourModel::query()
->whereIn($records)
->update(['status' => 'new status']);
Eskie
EskieOP2mo ago
oh got it.. thanks!

Did you find this page helpful?