-
Bug
-
Resolution: Fixed
-
Minor
-
2.5.6, 2.6.3, 2.7
-
MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
MDL-45678-006-master -
When viewing the grading table, a permissions callback will check for suspended users for each submission in the table.
Please view the attached callgraph alongside my explanation regarding my changes.
In assign_submission_comments::view_summary(), there is a call to the comment constructor. This constructor calls comment::check_permissions(), which is expensive – for each row!
According to the callgraph, the reason why comment::check_permissions() is expensive, is not because it calls has_capability(), but rather because it calls assignsubmission_comments_comment_permissions().
If you view assignsubmission_comments_comment_permissions(), it checks get_suspended_userids(), which generates an expensive SQL query in pg_query_params().
My fix is to cache the result of get_suspended_userids() in a MODE_REQUEST Cache.