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

Remove pre-fetching for grant associations #77

Merged
merged 1 commit into from
Jun 28, 2024
Merged

Remove pre-fetching for grant associations #77

merged 1 commit into from
Jun 28, 2024

Conversation

botimer
Copy link
Member

@botimer botimer commented Jun 28, 2024

When finding grants, we were loading associations for some general convenience. However, we do not inspect the grants in detail for our current use cases -- we supply very specific join/where conditions and check for their existence as the implementation of the authorization rules.

This preloading would be useful for building an administrative interface, for example, but is unncessary now. The reason to remove it is to avoid complexity and a performance problem introduced by fetching the institution memberships: we were loading all of them for any matched institution and doing an in-memory join on the object graph. In production, that can be a giant list, consuming excessive time and memory.

This problem can be solved by "adjusting the combine", applying appropriate pieces of the filter conditions the association nodes, but it is not worth doing now. We would be doing extra work and extra queries to throw the data away.

When finding grants, we were loading associations for some general
convenience. However, we do not inspect the grants in detail for our
current use cases -- we supply very specific join/where conditions and
check for their existence as the implementation of the authorization
rules.

This preloading would be useful for building an administrative
interface, for example, but is unncessary now. The reason to remove it
is to avoid complexity and a performance problem introduced by fetching
the institution memberships: we were loading all of them for any matched
institution and doing an in-memory join on the object graph. In
production, that can be a giant list, consuming excessive time and
memory.

This problem can be solved by "adjusting the combine", applying
appropriate pieces of the filter conditions the association nodes, but
it is not worth doing now. We would be doing extra work and extra
queries to throw the data away.
@botimer botimer merged commit 7e5e80d into main Jun 28, 2024
4 checks passed
@botimer botimer deleted the do-not-fetch branch June 28, 2024 22:22
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.

1 participant