I using laravel 5.6
My script to insert big data like this :
...
$insert_data = [];
foreach ($json['value'] as $value) {
$posting_date = Carbon::parse($value['Posting_Date']);
$posting_date = $posting_date->format('Y-m-d');
$data = [
'item_no' => $value['Item_No'],
'entry_no' => $value['Entry_No'],
'document_no' => $value['Document_No'],
'posting_date' => $posting_date,
....
];
$insert_data[] = $data;
}
\DB::table('items_details')->insert($insert_data);
I try insert 100 record with the script, it works. It success insert data
But if I try insert 50000 record with the script, it is very slow. I waited about 10 minutes and it did not work
How can I solve this problem?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire