magento2-regenerate_url_rewrites icon indicating copy to clipboard operation
magento2-regenerate_url_rewrites copied to clipboard

Script slowing down

Open gabrieljadeau opened this issue 4 years ago • 2 comments

Describe the bug HI, I am on a MAgento 2.3, with 12412 products in the database. When launching the commande php bin/magento ok:urlrewrites:regenerate --store-id 0, the first 10 seconds, the script generate around 100 products per sec. At 8000 row, the script generate 1 row per sec. Are you aware of this issue?

gabrieljadeau avatar May 21 '20 17:05 gabrieljadeau

Just a guess but could it be that your indexes are set to "update on save"? The script is running very fast here, although "only" ~4k products.

OvalMedia avatar May 27 '20 13:05 OvalMedia

Hi, tahks for your answer.

I ahav added 2 addAttributeTofilter on the product collection

->addAttributeToFilter('visibility', array('neq' => \Magento\Catalog\Model\Product\Visibility::VISIBILITY_NOT_VISIBLE))
            ->addAttributeToFilter('status',\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)

to the \OlegKoval\RegenerateUrlRewrites\Model\RegenerateProductRewrites::_getProductsCollection function.

Decreasing from 12k products to 3.8, everyrthing.

Moreover, I think you should skip the generation of the product url if the product name is empty. My client had this issue too, as some

->addAttributeToFilter('name', ['neq' => 'NULL']).

Let me know if that make sense.

BEst,

G

gabrieljadeau avatar May 28 '20 10:05 gabrieljadeau