Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-83532

Slow query in mark_course_completions_activity_criteria

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.1.15, 4.5
    • Course completion
    • 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?

            Unassigned Unassigned
            ghigio Federico Ghigini
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.