Maybe we missed a script somewhere, but our CONTENTREVIEW_ITEM wasn't indexed on contentId.
Displaying Assignment 2 summary for 172 students took a full minute. Most of that was queries looking up the Turnitin score, which was done by a select on CONTENTREVIEW_ITEM by contentId.
Indexing the table took the minute down to 4 sec.
It would actually be better to fetch all the scores for that task at once rather than querying student by student. There's also a REALM query once per student. I can't tell what it's doing. The query is the same each time (i.e. it doesn't depend upon the student).