We have found a bug in the millionaire game causing major performance issues on a Moodle 4.1 site. millionaire/play.php contains the following:
$select2 = '';
if (game_get_moodle_version() >= '04.00') {
$table .= ",{$CFG->prefix}question_bank_entries qbe,{$CFG->prefix}question_versions qv ";
$select2 = 'qbe.id=qv.questionbankentryid AND q.id=qv.questionid AND qbe.questioncategoryid='.$game->questioncategoryid;
if ($game->subcategories) {
$cats = question_categorylist( $game->questioncategoryid);
if (count( $cats) > 0) {
$select2 = ' qbe.questioncategoryid in ('.implode( ',', $cats).')';
}
}
}
If there are subcategories, $select2 is being overwritten, resulting in a query like the following:
SELECT COUNT(*)
FROM mdl_question q, mdl_qtype_multichoice_options qmo,mdl_question_bank_entries qbe,mdl_question_versions qv
WHERE qtype='multichoice' AND qmo.single=1 AND qmo.questionid=q.id AND qbe.questioncategoryid in (148967, ...);
This is joining mdl_question_bank_entries and mdl_question_versions but with no join condition so all records will be joined.
We have found a bug in the millionaire game causing major performance issues on a Moodle 4.1 site.
millionaire/play.php
contains the following:If there are subcategories,
$select2
is being overwritten, resulting in a query like the following:This is joining
mdl_question_bank_entries
andmdl_question_versions
but with no join condition so all records will be joined.