laravel too slow to update 1k records

Posted 1 year ago by phoenix404

Hi everybody, I have 3 tables products, products_description, products_attributes. "products" is the main table and others two table contain products primary id. These tables are updating with a .txt file which contains 40k lines or records for tables. The problem, I am facing is that updating is too slow. I just put 800 lines in *.txt and try to update it takes more than 10 min. This file contains: productid, ean, price, shipping, qty, name, lang etc. What I am trying with laravel is

$data = Products::updateOrCreate($whereColumn, $updateORNewInsertColumns);
$product_id = $data ->getKey();

ProductsAttributes::updateOrCreate( ["product_id" => $product_id],          $dataForProductsAttrbutesTable);

ProductsDescription::updateOrCreate( ["product_id" => $product_id],     $dataForProductsDescriptionTable);

Any Help? Thanks in advance!

Please sign in or create an account to participate in this conversation.