-
Improvement
-
Resolution: Fixed
-
Minor
-
3.11.6, 4.0, 4.1, 4.2
-
MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
-
MOODLE_404_STABLE
-
MDL-74676-master -
If a form contains a course search element (e.g. course completion options in a course or meta enrollment) it searches all courses of the corresponding instance by default.
In huge moodle instances (as we have here in Bavaria with > 400.000 courses) this literally kills course search (receiving a 500 error), so you have to change this function in some way to reduce the amount of courses to search.
We chose to try setting the option "limittoenrolled", so the trainer can only choose courses which he is actually enrolled to (this restriction is fitting to our use case). But we noticed, that limittoenrolled does not fix the issue. The reason may be that the corresponding function first searches all courses of the instance (which delivers a huge dataset in our case again) and then checks every course for enrollment.
I'd propose to change the order here:
- Get all courses the user is enrolled to
- Then do the database query for further searching
This should improve speed a lot for huge instances using this function - for most moodle instances nothing should change.