From 0e3191628efaac940fe7fc89e0cf3bc9b0da6562 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Mon, 24 Apr 2017 11:08:19 -0500 Subject: [PATCH] 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 --- main/inc/lib/events.lib.inc.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.inc.php index 82eeb9eb34..26fb24bb4d 100755 --- a/main/inc/lib/events.lib.inc.php +++ b/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; }