-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Price Indexer Performance Issue With Out of Stock Products #24415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Price Indexer Performance Issue With Out of Stock Products #24415
Conversation
- Relates to issue magento#24414
|
Hi @brucemead. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
| $select->where('stock_item.use_config_manage_stock = 0 AND stock_item.manage_stock = 1'); | ||
| } | ||
|
|
||
| if ($entityIds !== null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the null check is not needed and can be removed, simplifying code: the $entityIds parameter has declared type so in case the $entityIds parameter of modifyPrice() function is null, PHP would throw a fatal error.
sidolov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brucemead please, apply changes suggested by @aleron75
| } | ||
|
|
||
| if ($entityIds !== null) { | ||
| if (count($entityIds) > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we should count elements here? $entityIds always array, let's use $select->where('stock_item.product_id in (?)', $entityIds) in all cases if array is not empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah fair point I copied the implementation from here Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\Query\BaseFinalPrice::getQuery
|
might be faster if you intval $entityids too! also pull against the same thing in vendor/magento/module-catalog/Model/ResourceModel/Product/Indexer/Price/Query/BaseFinalPrice.php as it uses this same routine but with a between min/max(entityIds) which is horribly wrong to do for a list of 100 entityids (think 2000 and 2Million) over and over again! |
|
@brucemead , I am closing this PR now due to inactivity. |
|
Hi @brucemead, thank you for your contribution! |
- Relates to issue magento#24414 - Made changes based on feedback on PR
|
@sidolov I've pushed the suggested changes now. Sorry for the slow turn around I've been on leave recently. Thanks, |
app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php
Outdated
Show resolved
Hide resolved
|
Hi @aleron75, thank you for the review. |
- Relates to issue magento#24414 - Made changes based on feedback on PR - Resolving whitespace issue https://testing-service.magento-community.engineering/reports/magento/magento2/pull/24415/56e6453d1da3a1546212c6c35f78d77d/Statics/allure-report-ce/index.html#categories/479362f77c9377ec388bccba15830ad3/997602107dd59e40/
…xer-performance-fix' into fix/catalog-inventory-price-indexer-performance-fix # Conflicts: # app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php
|
@sidolov Just pushed a fix for the white space issue that was flagged here https://testing-service.magento-community.engineering/reports/magento/magento2/pull/24415/56e6453d1da3a1546212c6c35f78d77d/Statics/allure-report-ce/index.html#categories/479362f77c9377ec388bccba15830ad3/997602107dd59e40/retries |
|
✔️ QA Passed |
|
Hi @brucemead, thank you for your contribution! |
Description (*)
Within the reindexing process there is a bug which results in a delete query to be called for every out of stock product during a full or partial reindex.
Steps to reproduce (*)
php bin/magento indexer:reindex catalog_product_pricephp bin/magento cron:run --group=indexFixed Issues (if relevant)
Contribution checklist (*)