-
Bug
-
Resolution: Fixed
-
Major
-
4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.2
-
MOODLE_401_STABLE, MOODLE_402_STABLE
-
MOODLE_401_STABLE, MOODLE_402_STABLE
-
MDL-78622_401 -
During our large staging site Load and Performance testing found that if you add following 2 indexes on mdl_question_references table
1. composite index on (component, questionarea)
2. single index on (itemid)
It would improve the quiz's "Add question" feature by adding single question and from question bank a lot if you are running a large moodle site.
SELECT qbe.id
FROM {quiz_slots} slot
JOIN {question_references} qr ON qr.itemid = slot.id
JOIN {question_bank_entries} qbe ON qbe.id = qr.questionbankentryid
WHERE slot.quizid = ?
AND qr.component = ?
AND qr.questionarea = ?
we tested that this query takes 50 seconds to search records from 23 million records with current indexes but after adding above suggested indexes it took only 0 seconds.
So I would strongly recommend this as default to create index with these fields. Please find the patches in the attachment.