-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Catalog Category Indexing takes very long on MariaDB 10.3 with many products #25199
Comments
Hi @amenk. 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. @amenk do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Not able to reproduce, because it's a feature requests for a recent MariaDB 10.3 which is not yet supported by Magento 2.3 |
I also created an issue in the MariaDB tracker: https://jira.mariadb.org/browse/MDEV-20871 |
vendor/magento/module-catalog/Model/Indexer/Category/Product/Action/Full.php:287
Or should we put it into \Magento\Framework\DB\Select::where and convert is_numeric values to numbers ? Digging more down into the function leads to Zend Framework 1 code :( |
I tried to patch
But this does not catch the situation when you edit a categories anchor property -> the update of the url_rewrite index still uses quotes in strings |
I will inject the patch into \Magento\Framework\DB\Adapter\Pdo\Mysql::quoteInto |
We are noticing this problem too with MariaDB
We cannot even do a
So apparently it takes so long, that the temporary table "vanishes" in between (?). |
@fritzmg Which MariaDB version were you on before it became so slow? |
Before it was actually MySQL |
What we did was, to locally setup 10.3.18 in docker to reproduce the bug and test the fix. |
Yes, I've seen that on Stackoverflow :). When we get around to it, we will try the same. |
@amenk can you try it with MariaDB 10.3.17 also, i got a case where it was in 10.3.18 slow and in 10.3.17 fast. My currently suspect is a regession because of https://jira.mariadb.org/browse/MDEV-20109, see the other Reports linked there. |
We are noticing similar problems with MariaDB |
I'm also running mariadb 10.3.18 and having these issues. Indexers just never stop being triggered now even after tripling our hardware speed. Attempting to clone a server then upgrade to 10.4 on it and test indexing on it. |
10.4 latest made zero difference. M2 mview and indexer system are once again trash and once again costing my client money and me time. |
How did you remove "IN" for entity_id altogether? Did you still select the same rows? Via a JOIN? Please maintain a constructive tone ;-) |
I just manually changed the query for testing, I'm researching now if the entity_id's are do to a batch or handed off from a prior query. If it's just the mview batching, then it's 30,000 faster to not batch than to do it. |
It does select all products and then batch them for a root category full reindex. Before it was 5 hours. Will test some more then release a module to override default m2 behavior. Honestly, should probably just write a module to overwrite all indexers at some point they are terrible I have worked on this project nearly 3 years and this is a constant source of suffering. Many other ecommerce systems don't have something like this for good reason, just more examples of overengineering to make stuff worse and more costly to develop, run, and maintain. I can't keep a positive tone because I have nothing positive to say about it, and I doubt you would either if your quality of life and that of your clients was worsened by poorly designed magento2. If we could switch off it we would but sunk cost is a lot at this point and it's as I said a few years work. |
https://github.com/SoloDevAtrix/snippets/blob/master/indexer_catalog_category_products.php My original glance over that it selected all products for root was wrong they actually do quite a bit of specific join conditions on all types. I have my database matching a full run pretty closely. Only difference is a few positions are adjusted in my view, for the better, as well as don't have weird one off where it'll put in entries into the index for things like Enabling putting in all the non parent non leaf options doubles the size as well as seems to achieve nothing. So left it off. If you use it power to you, I offer zero warranty, even implied, and you're on your own to get it to work. It's also alpha code at best so if you run into a bug then you ran into a bug cuz it's just finished with it's first test run. I just think it's really sour how badly m2 code runs this. You're filling ONE TABLE. Here's the reasons why m2's queries are SLOW SLOW SLOW:
Last note, my working example code, doesn't follow m2 ideology. At all. If you guys cared as much about pragmatic efficient solutions as you did your cursed ideology then maybe m2 wouldn't be a garbage heap. This is a serious problem for my client, it's actually maybe costing him his entire business. The indexers lock up the database, adding hardware barely helps. Locked up database means slow loads on any page not already cached in varnish. Cache warming helps but can't do every page on the site. Leads to lower conversions. He can't fix or edit products because again, it's so slow. And when he does, he gets locked out because hours of indexers are running. So if my language is harsh, that's why. I've worked for this client oh, 9 years now. The switch to magento2 is by far the worst decision that's ever been made for the company. |
set in_predicate_conversion_threshold = 4294967295; seems also to help, as a workaround. There might be a fix in MariaDB 10.3.21 |
Migrated to MariaDB 10.4.12 on my M2.1.7 install with 6000 products (centos 8, php7.0)
|
Thanks to this indexing of category products went from impossible (7+ hours) to 10 seconds! Thanks a lot! |
✅ Confirmed by @engcom-Alfa Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
I seem to be getting a similar problem, show processlist shows lots of things randomly sending data for what seems like forever. Originaly seemed to start happening with related products but my query for that was slightly modified and thought it was my fault however changed it and it went away. Now however am noticing queries hanging indefinitely when running schema recurring for Magento_Indexer section of setup upgrade... I'm on 2.3.7 and commits here are for 2.4.2 will there be a similar fix available for 2.3.x as hoping it is a similar issue? |
I had this issue with 2.3.7-p3 and MariaDB 10.4.24 |
For anybody on Maria db 10.4 and experiencing long reindexing times please do optimizer_switch='rowid_filter=off' |
What @realadityayadav told helped a bit in the situation I've been. Besides that, a huge impact had the changes for The combo I had to deal with: |
Hi, I was struggling with the same problem, catalog_category_product index take too long, I resolve it by reducing batchRowsCount:
MariaDB: 10.4.29 |
I have improved the Magento category indexer performance by adding a given parameter to the Warden configuration yaml file by given link. |
@RakeshJesadiya Thanks for the tip. My DB instance gave me this error:
So instead in the
And then in
|
Description (*)
I know MariaDB 10.3 is not yet supported, as per dev docs, so I add this as feature requests, while it will manifest as a bug as soon as we support MariaDB 10.3
Magento should remove the quotes in the SELECT entity_id IN statement when creating indexes. The entity_ids are not strings, and this seems to confuse the optimizer.
Steps to reproduce:
Expected behavior (*)
Catalog Category Indexing should run quickly, on MariaDB 10.1 and on 10.3.18
Benefits
Shop ownes can use MariaDB 10.3.18
Additional information
See this answer on StackExchange: https://magento.stackexchange.com/a/293345/81
I took the full query which is run several times (for each store view) on the catalog category products indexer and extracted the select part
This query alone runs 8 minutes on Maria DB 10.3
When I simply remove all the quotes via s/'//g in vi in the line with the "IN" statement I get
Next steps
I will try to provide a patch.
The text was updated successfully, but these errors were encountered: