I'm dealing with this same issue right now. Did you ever figure anything out?
Apr 14, 2023
2
Level 1
Bulk Insert is very slow when the data contains values with a question mark
Laravel Version: 9.52.5 PHP Version: 8.1.7 Database Driver & Version: 10.6.8-MariaDB-1:10.6.8+maria~stretch
Hello
Insert is very slow when I want to save values with a question mark.
When processing for a long time, I immediately see my data in the DB table, but insert is still not finished.
but if I escape the question mark with two slashes, then the insertion works quickly. But the data is saved with a single slash.
A similar problem with: upsert, insertOrIgnore
Tell me how to get around this problem?
Example:
for ($i=0;$i<=1000;$i++)
{
$data[] = [
'host' => 'site.ru',
'url' => "https://site.ru/page/?query=$i",
'created_at' => \DB::raw('now()'),
'updated_at' => \DB::raw('now()'),
];
}
Model::insert($data);
Please or to participate in this conversation.