Sometimes, it happens that the amount of indexing operations skyrockets (up to 10x the normal amount of indexing operations) without an apparent reason. When digging deeper, a few common problems may arise which causes these spikes.
The most probable reason is an automatic import of products from an ERP system into the catalog by a third-party tool, extension or custom code. The tool can update a lot of information on the products in the catalog: it can change the stock, the prices and any other information on a product. All these changes can trigger a save
event in Magento. the extension listens to these save
events to automatically keep your products up to date. That’s why each change will trigger an indexing operation.
This can become really problematic when the third-party tool, extension or custom code triggers multiple save
events per product. When it’s updating the price of a product and saving this change, and after that it’s updating the description of the product and saving this change too, the save
event will be fired twice. This means the extension will update the index twice, even though one time would have been enough. This can cause a massive spike in the amount of indexing operations.
How to fix it
First of all, identify which plug-in or piece of code triggers all the save events. When the problem is found, try to limit the amount of operations it performs. If this is not possible, try to disable indexing while the process of the tool is running, and enable indexing again when it’s done. When all of the above fails, try to use the indexing queue. The indexing queue will merge jobs if possible to limit the amount of indexing operations.
Note: Some third-party tools bypass the save-mechanism in Magento by updating the database directly. This can cause your indices to be out-of-sync. A full reindex is needed to fix this issue.