-
Improvement
-
Resolution: Fixed
-
Minor
-
2.2.1, 2.3
-
MySQL
-
MOODLE_22_STABLE, MOODLE_23_STABLE
-
MOODLE_21_STABLE, MOODLE_22_STABLE
-
MDL-31495-master -
In the developer forum (at http://moodle.org/mod/forum/discuss.php?d=195237) I suggested a rewrite of one of the SQL queries involved in the upgrade to the new quiz engine:
Replace the following code (from question/engine/upgrade/upgradelib.php):
$questionsstatesrs = $DB->get_recordset_sql("
SELECT *
FROM
WHERE attempt IN (
SELECT uniqueid FROM {quiz_attempts} WHERE $where)
ORDER BY attempt, question, seq_number, id
", $params);
with this
$questionsstatesrs = $DB->get_recordset_sql("
SELECT DISTINCT s.*
FROM {question_states}
s
JOIN
ON (s.attempt = uniqueid)
WHERE $where
ORDER BY s.attempt, question, seq_number, s.id
", $params);
It seems to be equivalent and is faster.