Optimize SourceInventoryView queries #1317
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.
This PR does two things:
ChantInventoryView
, which has been superseded bySourceInventoryView
select_related
optimization in our SourceInventoryView that @ahankinson applied in Improve loading of chants for index view #1247As far as I can tell, the renaming of ChantIndexView -> SourceInventoryView was going on for a period of time. While it was in progress, @ahankinson applied an optimization to the ChantIndexView, whereas the old code had already been copied into the new SourceInventoryView. Once the paths/views in
urls.py
were updated, we switched back to using unoptimized code.It took me a while to figure out why changes I was making to
ChantInventoryView
were not having any effect on our SQL queries whenever I visited/source/123627/inventory/
- it will be a good thing to have the old view deleted, to prevent others from going through similar confusion.I ran
test_views
, and all comprising tests pass.This PR should properly resolve #1238.