Reduce database usage of get_all_exercise_results_by_course() by removing query of which results are unused. In test case with 1000 students and 5M records in track_e_attempt, provides a performance gain of 29% for "My progress" page - refs BT#12663

1.9.x
Yannick Warnier 9 years ago
parent 6c4ebde3bf
commit 0e3191628e
  1. 5
      main/inc/lib/events.lib.inc.php

@ -1115,11 +1115,6 @@ function get_all_exercise_results_by_course($course_code, $session_id = 0, $get_
$list = array();
while($row = Database::fetch_array($res,'ASSOC')) {
$list[$row['exe_id']] = $row;
$sql = "SELECT question_id, marks FROM $table_track_attempt WHERE exe_id = {$row['exe_id']}";
$res_question = Database::query($sql);
while($row_q = Database::fetch_array($res_question,'ASSOC')) {
$list[$row['exe_id']]['question_list'][$row_q['question_id']] = $row_q;
}
}
return $list;
}

Loading…
Cancel
Save