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

Slow upgrade_grade_item_fix_sortorder

XMLWordPrintable

    • MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • MOODLE_25_STABLE, MOODLE_26_STABLE
    • Hide

      Follow testing instructions from MDL-41062 (you will need an initial instance older than 23/Jan/14 )

      Show
      Follow testing instructions from MDL-41062 (you will need an initial instance older than 23/Jan/14 )

      The upgrade_grade_item_fix_sortorder function is still much too slow, even after MDL-43946.

      On one of our sites, it appears this will take at least several hours to finish (I didn't let it go, just guessing from what progress it made after 30 minutes...) all the while blocking much happening with grade items.

      The problem appears to be that when courses have a large amount of grade items (in our case some with 4000 and more) the related rows are updated thousands of times; besides the O(N*N) time complexity there is a huge bloating of the table during the transaction which causes its own problems.

      My patch moves this update loop for a given course to memory in PHP, then writes the updates back out when that course is finished. This results in only O(N) rows updated, and completes in a few seconds on a problematic dataset.

            Unassigned Unassigned
            tlevi Tony Levi
            Damyon Wiese Damyon Wiese
            Damyon Wiese Damyon Wiese
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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