-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Improve backoffice category display performance #39830
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
base: 2.4-develop
Are you sure you want to change the base?
Improve backoffice category display performance #39830
Conversation
Hi @Dnd-Mafer. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento run all tests |
Hello @Dnd-Mafer, Please merge the latest changes from https://github.com/magento/magento2 to this branch. We are unable to do so due to access issue. Meanwhile moving this PR Thanks |
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.
Pull Request Overview
This PR improves the performance of the backoffice category display by replacing a time-consuming subselect with a faster join approach.
- Removed the IN subselect in the SQL query
- Introduced a joinLeft on the category entity table to handle category hierarchy
- Updated the join condition for product counts
Comments suppressed due to low confidence (2)
app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php:386
- The updated join condition using a direct expression may not exactly replicate the previous subselect behavior, potentially affecting product counts for categories with multiple hierarchy levels. Please verify that this join logic covers the full intended category hierarchy.
new \Zend_Db_Expr("ce2.path LIKE CONCAT(ce.path, '/%') OR ce2.path = ce.path")
app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php:392
- Changing the join condition to an equality match may not account for all children categories as the previous subselect did. Confirm that this logic accurately maintains the intended relationship between categories and their products.
cp.category_id = ce2.entity_id
Hello @Dnd-Mafer, Gentle reminder to update the branch with the latest updates 2.4-develop. Or give us access to do the same. Till the time moving this PR Thanks |
This PR improvement performance of categroy display in BO. It fixes #39829
Description
This PR change a time consuming subselect in SQL query for a fast join.
Fixed Issues
Fixes #39829
Manual testing scenarios
Connect to BO
Go on Catalog -> Category
Check that numbers in parenthesis near category names are corresponding to number of category products
Contribution checklist