-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
4.1.15, 4.5
-
MOODLE_401_STABLE, MOODLE_405_STABLE
There is a slow query issue in completion/classes/api.php.
It's the query in the mark_course_completions_activity_criteria function.
This query takes approximately one hour and thirty to complete.
I have attached a report that shows you for each course:
- how many activities are presents
- how many users are enrolled (please note that some users are enrolled multiple times in the same course via different enrollment methods)
In the following table, you can see how many records each table has.
table | count |
---|---|
mdl_course_completion_criteria | 4235 |
mdl_course | 1167 |
mdl_context | 12925 |
mdl_role_assignments | 1167331 |
mdl_course_modules | 4499 |
mdl_course_modules_completion | 506134 |
mdl_course_completion_crit_compl | 505622 |
I have also attached the EXPLAIN query report.
I'm using postgreSQL 16
Can you help me to find a solution?