Description
Preconditions and environment
- Magento version 2.4.5+ (or any release after 263c17f)
- Have a lot of products (the more, with more prices, the easier this issue is to reproduce for demo)
Steps to reproduce
- Reindex catalog_product_index_price
- Observe that since 263c17f the performance of deleteOutdatedData is much worse (around 800-1200x slower than it should be in our very large instances with ~30 million prices)
Expected result
Price reindex is workable, and uses indexes for its join in deleteOutdatedData, because they exist
Actual result
It's 800-1200x slower than it should be, making a reindex take multiple days (based on the runtime of the individual queries, but can't tell for sure, as i'm not waiting that long), when on previous versions it took 4 hours
Additional information
When catalog_product_index_price_temp is created, it's based on catalog_product_index_price_tmp , which since 263c17f has had different primary key and indexes to the main table, meaning this JOIN has no indexes to use for the select, and is forced to do a full tablescan
We reproduced it as follows:
-
All indexes have been switched to
realtime
mode -bin/magento indexer:set-mode realtime
-
Then we started indexing only for MSI -
bin/magento indexer:reindex inventory
As @vladimirspucko described above, the inventory indexing itself was performed quickly, about a minute for 850k products in our case. But then a plugin came into operation, which starts price indexing in realtime
mode:
\Magento\InventoryCatalog\Plugin\InventoryIndexer\Indexer\Stock\Strategy\Sync\PriceIndexUpdatePlugin::afterExecuteList()
which calls \Magento\Catalog\Model\Indexer\Product\Price\Processor::reindexList()
And if the mode is not schedule
this indexing has never been performed on our installation with 850k products.
Note: if we use schedule
mode, then full inventory indexing takes about 50 seconds for all the same 850k products
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status