-
Improvement
-
Resolution: Cannot Reproduce
-
Major
-
None
-
4.1.1, 4.2.1
-
10
-
Team Hedgehog 2024 Review 1, Team Hedgehog 2024 Sprint 2.1
We run a very large moodle instance with about 14 million activities in about 400,000 courses. More than 50,000 teachers manage their courses independently. Here we noticed that the queries
$DB->delete_records_subquery('course_modules_completion', 'coursemoduleid', 'id','SELECT id from {course_modules} WHERE course = ?', [$courseid]); |
|
$DB->delete_records_subquery('course_modules_viewed', 'coursemoduleid', 'id','SELECT id from {course_modules} WHERE course = ?', [$courseid]); |
in lib/moodlelib.php run extremely frequently and therefore for a relatively long time.
MDL-58266 was the first to add the second query.
The use of sub-queries and especially of two identical sub-queries should be avoided for performance reasons.