Closed MohammadZarifiyan closed 1 week ago
11.32
8.1
MySQL 8.0.31
Using syncWithoutDetaching will cause a shortage of RAM in the system.
syncWithoutDetaching
First create post_user pivot table and add 10 million rows to it. The run the following code:
post_user
$user = \App\Models\User::first(); $post = \App\Models\Post::first(); $user->posts()->syncWithoutDetaching([ $post->getKey() => ['status' => 'pending'] ]);
I would suggest to use mass update instead of this for this case. Bear in mind it will not trigger events like that. So in conclusion I don't think this is a bug/issue.
Laravel Version
11.32
PHP Version
8.1
Database Driver & Version
MySQL 8.0.31
Description
Using
syncWithoutDetaching
will cause a shortage of RAM in the system.Steps To Reproduce
First create
post_user
pivot table and add 10 million rows to it. The run the following code: