Showing results for 
Search instead for 
Did you mean: 

Why after product save reindex all the stores ?

Why after product save reindex all the stores ?

We have a site that have 1 website and about 40+ stores . after saving a product , it will take a long time . . I debugged the code, and found that 

in vendor/magento/module-catalog/Model/Indexer/Category/Product/AbstractAction.php

protected function reindex()
foreach ($this->storeManager->getStores() as $store) {
if ($this->getPathFromCategoryId($store->getRootCategoryId())) {

So it will loop all the stores and reindex ... So I think that  why it will take a long time . . 

I know that the product is desinged to relate to webstie not store . we have create an attribute to seperate the stores , so each product will relate to a store_id .  But when store increases. it is  too slow to save the product all just reindex from the command line. 

Can anyone give me some suggestions ? Thanks in advance.


Re: Why after product save reindex all the stores ?

By defaful, When any product is saved at that time reindex will automatically happend because when you check from admin panel,

System -> Tools -> Index Management

Default Indexer setting will be Update On Save.

So any time product or category save indexer will be happened.


Now you have to prevent this save after product save you need to change indexer mode to Update by Schedule from Index management. Using this settings you need to manually run indexer or set cron to run indexer.

Set Update by Schedule for Indexer just go to 

System -> Tools -> Index Management

Select ALL from grid and choose Update By Schedule from action dropdown above grid and submit.


Clear cache and check again.

If Issue Solved, Click Kudos/Accept As solutions.

Re: Why after product save reindex all the stores ?

Hello @zgchenai


Magento 2 saving all attribute data store wise depends on attribute creation.


For large store, you can change index mode to manual mode.


Hope it will help you.

Re: Why after product save reindex all the stores ?

You need to change indexing method to Update on schedule for products. You can do it using following command.

bin/magento indexer:set-mode schedule catalog_category_product catalog_product_category

Afterwards products will re-index as you have set cron for that. You can do it manually by running re index command from CLI.