-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Root category url_key causes full table scans #30519
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
Comments
@georgios-2317, thank you for your report. |
Further investigation in this issue proved that the offending code is in Anyhow, this is where I am at now (and back at full speed - no more full table scans):
|
Hi @george-vlahakis. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
✅ Confirmed by @sivaschenko Issue Available: @sivaschenko, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
Hi @george-vlahakis, Thanks for your reporting and collaboration. We have tried to reproduce the issue in Latest 2.4-develop instance and the issue is no more reproducible.Kindly refer the attached video. Screen.Recording.2025-05-09.at.3.33.50.pm.movCategory was saved successfully.Hence we are closing this issue. Thanks. |
Having a database with approx 4K categories (anchors) and 16K products spread throughout the tree, making a url_key change on a root category causes significant delays (in hours) to update children products and re-generate URL rewrites.
In specific:
When changing the URL key of a root category (say level 1) it will trigger a cascading regeneration of all url rewrites for all products within. This is expected behavior. However, the process increasingly slows down as the size of
catalog_url_rewrite_product_category
increases. I have seen this process take over 5 hours!To replicate, and test, I moved to using Oleg's extension (here: https://github.com/olegkoval/magento2-regenerate_url_rewrites) which in essence does the same thing.
Regenerating url rewrites took over 8 hours for two stores.
Further investigation with slow_query enabled showed that DELETE sql calls on
https://github.com/olegkoval/magento2-regenerate_url_rewrites
before inserts are causing full table scans. Example:The above took over 2 seconds to execute and causes a full table scan on
catalog_url_rewrite_product_category
:I tried adding a key on
url_rewrite_id
(there is none) but had no speed changes and a full table scan is still preferred by MySQL.Assuming, Magento 2.x correctly produces the multiple url rewrites (creating a huge url_rewrites table) then this behavior renders Magento completely unusable for large datasets.
Preconditions
Steps to reproduce
Expected result
Actual result
The text was updated successfully, but these errors were encountered: