solidus_admin: Improve Products loading performance#6444
Open
sascha-karnatz wants to merge 3 commits intosolidusio:mainfrom
Open
solidus_admin: Improve Products loading performance#6444sascha-karnatz wants to merge 3 commits intosolidusio:mainfrom
sascha-karnatz wants to merge 3 commits intosolidusio:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6444 +/- ##
==========================================
- Coverage 89.66% 89.45% -0.22%
==========================================
Files 990 919 -71
Lines 20792 18980 -1812
==========================================
- Hits 18644 16979 -1665
+ Misses 2148 2001 -147 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Eager load variant images and prices to avoid N+1s and use .size instead of .count to avoid an extra query.
The name column has an index and it is the same default sorting as in solidus_backend. Remove distinct to reduce the response time even more. The view has no included left joins and it isn't necessary to filter duplicates. This reduce the response time for database with 700000 products from 1 second to 67ms.
The distinct isn't necessary, because the result will be put into an IN filter and there is no reason to filter out possible duplicates. It slows only the query.
7701c60 to
65b99bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This is a small set of improvements to increase the loading performance of the default product view. It is also removing a few N+1 queries.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: