-
Bug
-
Resolution: Fixed
-
Critical
-
2.1, 2.2
-
MOODLE_21_STABLE, MOODLE_22_STABLE
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
The SQL query made from function set_max_mark_in_attempts() in file question/engine/datalib.php line 876 is taking about 15-20 seconds in our Moodle installation (~ 80 000 users).
Interesting is that, the original SQL query:
UPDATE question_attempts SET maxmark = 6.7 WHERE questionusageid IN (SELECT quiza.uniqueid FROM quiz_attempts quiza WHERE quiza.quiz = '10001') AND slot = '14';
|
takes about 15 seconds to run, but when i separate the sub-query:
SELECT quiza.uniqueid FROM quiz_attempts quiza WHERE quiza.quiz = '10001';
|
UPDATE question_attempts SET maxmark = 6.7 WHERE questionusageid IN (<result here>) AND slot = '14';
|
then the code takes only some milliseconds total.