Skip to content

[2.3] Optimize ID to SKU lookup of tier prices #14700

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

See also #14699 (port to 2.2)

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

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

@toddbc toddbc deleted the 2.3-tier-price-lookup branch May 25, 2018 17:01
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