Skip to content

[2.2] Optimize ID to SKU lookup of tier prices #14699

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

Merged

Conversation

toddbc
Copy link
Contributor

@toddbc toddbc commented Apr 14, 2018

Description

Previously, with a large number of tier or group prices, each tier would separately make a database query to lookup the associated SKU.

This instead load the ID to SKU mapping once, and uses it for all tiers.

When lookup up a batch of 100 SKUs with hundreds of tier prices per SKU, this cuts lookup time from on the order of 4s to on the order of 0.1s or less.

When editing a B2B shared catalog with many assigned products that have many associated tiered pricing rules, this results in a 50% decrease in load time.

Fixed Issues (if relevant)

Cloud 77962 is not fixed, but is improved.

Manual testing scenarios

  1. Create a Magento B2B shared catalog with hundreds of products.
  2. Assign price discounts via the shared catalog.
  3. Checkout with the product and ensure pricing is respected.

Note: there should be no functional change with this PR, except that with hundreds of shared catalogs and thousands of products, editing shared catalogs (as well as other operations) should be faster.

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 on Travis CI are green)

Previously, with a large number of tier or group prices, each tier would separately
make a database query to lookup the associated SKU.

This instead load the ID to SKU mapping once, and uses it for all tiers.

When lookup up a batch of 100 SKUs with hundreds of tier prices per SKU, this cuts
lookup time from on the order of 4s to on the order of 0.1s or less.
@magento-engcom-team
Copy link
Contributor

@toddbc thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@dmanners
Copy link
Contributor

Hi @toddbc let me run some tests on this PR and try to process this. If I need anything I will get back to you here about it.

Also thank you for the forward at #14700 I will process the 2.2 version first and then once that is complete move onto the 2.3 version so that the process flow is a little smoother.

Feel free to reach out to me if you have any questions.

@toddbc
Copy link
Contributor Author

toddbc commented Apr 16, 2018

Thanks - already accepted.

@magento-engcom-team magento-engcom-team merged commit 2abd343 into magento:2.2-develop Apr 27, 2018
@magento-engcom-team
Copy link
Contributor

Hi @toddbc. Thank you for your contribution.
Changes from your Pull Request will be available with the upcoming 2.2.5 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants