Skip to content
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

Prefetch related solr documents and then lazily convert to SpeedyAF proxy objects #9

Merged
merged 12 commits into from
Oct 18, 2022

Conversation

cjcolvar
Copy link
Member

For objects with a large number of related child or parent objects SpeedyAF's lazy approach can result in hundreds or thousands of solr queries for individual documents. This PR figures out what all of these will be and fetches all of the documents in one solr request. It sets attributes on the proxy object with the pre-fetched solr documents then when a relation is later accessed it will cast it into a proxy object. For a show view of a particular object in production Avalon at IU these changes reduce the amount of time spent in solr requests from about 30s to about 0.5s.

Copy link
Contributor

@masaball masaball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@cjcolvar cjcolvar merged commit 96ca66a into main Oct 18, 2022
@cjcolvar cjcolvar deleted the caching branch October 18, 2022 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants