-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Cache submission annotated?
as boolean
#4379
Conversation
annotated?
as boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I'm not sure about the migration query because a huge where clause with id's will be generated. I would iterate in batches over the annotations and update per batch. But if it works on naos, it will probably be fine.
Tested on naos. It does not generate a where clause with the ids. Rails is smart enough to generate a subquery, so everything happens in sql. |
This pull request caches
annotated?
for every submission in the database. The goal is to avoid a lot of queries that check if a submission is annotated.This query was third in our server time usage:
The cause was the check if a submission has annotations on every page were submissions are listed. (And for example on the activity page, this is loaded every time a user submits)
I also updated the
released
scope to also includeleft_joins(:evaluations)
as this was a mandatory addition to get this scope working and thus always included when this scope was used.I also used the new boolean to check whether annotations should be fetched on submission show.
I left the migration query in this time as it took only 52002.3ms on Naos and the impact is larger then in #4378 because we also use it to determine if annotations should be fetched.
replaces #4378