Which approach is better and fast to update bulk product update in magento 2.3+ ? e.g i want to update 1000+ products at a time using cron job or command line
please suggest
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->create('\Magento\Store\Model\StoreManagerInterface');
$storeIds = array_keys($storeManager->getStores());
$action = objectManager->create('\Magento\Catalog\Model\ResourceModel\Product\Action');
$updateAttributes['name'] = "test";
$updateAttributes['price'] = 100;
$productCollectionFactory = $objectManager->get('\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');
$collection = $productCollectionFactory->create();
$collection->addAttributeToFilter('sku', 'A960-CQ');
$collection->addAttributeToSelect('*');
foreach ($collection as $product)
{
foreach ($storeIds as $storeId) {
$action->updateAttributes([$product->getId()], $updateAttributes, $storeId);
}
}