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

Question restore code very slow with large numbers of questions

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9.1
    • Fix Version/s: 3.0
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide
      • Create a site with a number of different questions
      • Visit site admin > plugins > plugins overview
      • Make sure the question types with existing questions are correctly identified (i.e. they cannot be deleted)
      • Backup and restore a course
      • Make sure there are no errors in qtype_random, qtype_essay after restore steps (it does not matter if the question types are in use in the course).
      Show
      Create a site with a number of different questions Visit site admin > plugins > plugins overview Make sure the question types with existing questions are correctly identified (i.e. they cannot be deleted) Backup and restore a course Make sure there are no errors in qtype_random, qtype_essay after restore steps (it does not matter if the question types are in use in the course).
    • Affected Branches:
      MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-51412_qtype_index

      Description

      Several question types (including core types qtype_random, qtype_essay, and 3rd-party question type qtype_poodllrecording), run a query at the end of the course restore process that searches the table 'mdl_question' on the 'qtype' field.

      Similarly the 'plugins overview' page, causes each question type to do a search on this same table/field to see if the question is in use anywhere (and if it can be deleted).

      On a small site, this is fine. On a site with, for example, 6.5 million entries in mdl_question, these queries can take 6-10 seconds for each question type involved (on a client site, with a small course, 31 out of 35 seconds of the course restore is spent on the post-restore functions for the above question types).

      An index on the field 'qtype' should drastically speed up these queries - would it be reasonable to add that to the table definition?

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                16/Nov/15