Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.5.6, 2.6.3, 2.7
-
Component/s: Assignment, Comments, Performance
-
Testing Instructions:
-
Affected Branches:MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
-
Fixed Branches:MOODLE_26_STABLE, MOODLE_27_STABLE
-
Pull from Repository:
-
Pull Master Branch:
MDL-45678-006-master -
Pull Master Diff URL:
Description
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.