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

Completion cron SQL optimisation (significant on large installations)

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      To test:

      Enable course completion site-wide
      Create a course and enable course completion
      Enrol some users in this course
      Run the cron, noting text "Aggregating completions for user x in course $idofcoursecreated'
      Re-run the cron, the 'aggregating completions for user...' text above should not appear on the second cron run.

      Show
      To test: Enable course completion site-wide Create a course and enable course completion Enrol some users in this course Run the cron, noting text "Aggregating completions for user x in course $idofcoursecreated' Re-run the cron, the 'aggregating completions for user...' text above should not appear on the second cron run.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:

      Description

      Completion criteria aggregation is triggered by the 'reaggregate' field in the 'course_completions' table being set to timestamp. Once the completion cron has finished, it resets all aggregated completions back to a 'reaggregate' value of 0. Unfortunately the SQL that does this is slightly wrong, and not only are the aggregated completions reset to 0 - but completions with a 'reaggregate' value of 0 are also updated (albeit to 0). This causes a performance hit that has been measured to be quite significant on large installations.

        Attachments

          Activity

            People

            Assignee:
            sry_not4sale Aaron Barnes
            Reporter:
            sry_not4sale Aaron Barnes
            Peer reviewer:
            Ankit Agarwal
            Integrator:
            Sam Hemelryk
            Tester:
            David Monllaó
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/Sep/12