[2.3] Optimize ID to SKU lookup of tier prices #14700
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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