Skip to content
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

Improve performance of "in" condition on some version of MySQl #27129

Merged
merged 20 commits into from
Sep 4, 2020

Conversation

kandy
Copy link
Contributor

@kandy kandy commented Mar 3, 2020

Improve performance of "in" condition on some version of MySql

Description (*)

Related Pull Requests

Workaround https://jira.mariadb.org/browse/MDEV-20900

Fixed Issues (if relevant)

  1. Fixes Catalog Category Indexing takes very long on MariaDB 10.3 with many products #25199 :Catalog Category Indexing takes very long on MariaDB 10.3 with many products

Manual testing scenarios (*)

see #25199

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Mar 3, 2020

Hi @kandy. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kandy,
Your changes looks good, except one small missing space.
Due to definition of done all changes should be covered with some tests. Could you cover your changes with any type of test?

…ct/Type/Configurable/Product/Collection.php

Co-Authored-By: Ihor Sviziev <ihor-sviziev@users.noreply.github.com>
@ihor-sviziev
Copy link
Contributor

@kandy I am closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for the collaboration!

@m2-assistant
Copy link

m2-assistant bot commented Mar 19, 2020

Hi @kandy, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ihor-sviziev ihor-sviziev added the Severity: S1 Affects critical data or functionality and forces users to employ a workaround. label May 7, 2020
@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-7542 has been created to process this Pull Request

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Preconditions:

Magento 2.4-develop
MariaDB v.10.3.18

Screenshot from 2020-08-05 13-49-00

Manual testing scenario:

  1. Change value for simple products to 50000 for example (setup/performance-toolkit/profiles/ce/small.xml);
  2. Run in console: bin/magento setup:perf:generate-fixtures /var/www/html/magento24/setup/performance-toolkit/profiles/ce/small.xml for example

Before: ✖️ Indexation works very slow, freezes and does not pass...

Screenshot from 2020-08-05 13-47-39

After: ✔️ Catalog Category Indexing run quickly. For 50,000 products, it took about 3 minutes.

2020-09-01_23-29

and all products were successfully indexed in about 2 minutes

@engcom-Alfa engcom-Alfa added the QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope label Sep 2, 2020
@gabrieldagama
Copy link
Contributor

@magento run all tests

@m2-assistant
Copy link

m2-assistant bot commented Sep 4, 2020

Hi @kandy, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ihor-sviziev
Copy link
Contributor

Finally it got merged! 🎉

@kandy kandy deleted the mysql-in-condition branch October 2, 2020 18:44
@Quazz
Copy link

Quazz commented Nov 9, 2020

Glad to see this get merged!

I found 2 more instances of this in the catalog_url_rewrite module. I think the reason it wasn't in this PR is because it doesn't go through the DB/Select but instead it is about creating a temporary table.

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/CatalogUrlRewrite/Model/Map/DataCategoryUrlRewriteDatabaseMap.php#L91

That one especially can take a long time to get it done.

Here's the other one:
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/CatalogUrlRewrite/Model/Map/DataProductUrlRewriteDatabaseMap.php#L104

It can be wrapped in an array_map('intval', array_merge(...)) in order to force the productids to come through as INT. There is no option to pass type along, therefore it must be forced into the Query instead.

@ihor-sviziev
Copy link
Contributor

@Quazz feel free to create PR with your suggested changes

@osrecio osrecio mentioned this pull request Jun 1, 2022
6 tasks
osrecio added a commit that referenced this pull request Jun 1, 2022
When the MariaDB is try to cast the entitys_ids from string to integer is to slow,

Check: #27129
@m2-assistant m2-assistant bot mentioned this pull request Jun 1, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Award: advanced Award: bug fix Component: Bundle Component: BundleGraphQl Component: Catalog Component: CatalogInventory Component: CatalogRule Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Catalog Category Indexing takes very long on MariaDB 10.3 with many products
9 participants