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

1.8 -> 1.9 upgrade freezes during quiz upgrade

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Component/s: Quiz
    • Labels:
      None
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      A badly designed query slows the upgrade down to a crawl on a live site using quizzes:

      SELECT u.id, u.id AS userid, g.grade AS rawgrade, g.timemodified AS dategraded, a.timefinish AS datesubmitted
      FROM user u, quiz_grades g, quiz_attempts a
      WHERE u.id = g.userid AND g.quiz = 8
      AND a.timefinish = (SELECT MAX(aa.timefinish) FROM quiz_attempts aa WHERE aa.quiz = 8 AND aa.userid = u.id AND aa.preview = 0) ;

      The correct way to get the desired results is:

      SELECT u.id, u.id AS userid, g.grade AS rawgrade, g.timemodified AS dategraded, MAX(a.timefinish) AS datesubmitted
      FROM user u, quiz_grades g, quiz_attempts a
      WHERE u.id = g.userid AND g.quiz = 8 AND u.id = a.userid AND a.quiz = 8
      GROUP BY u.id, g.grade, g.timemodified;

      Which executes super-fast. Thanks Eloy for your analysis!

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Mar/08