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

Plug-in overview page triggers queries that can take forever to run

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.2
    • Fix Version/s: 2.6.5, 2.7.2
    • Component/s: Questions, Quiz
    • Labels:

      Description

      When loading the plug-in overview page, I am seeing queries like:

      SELECT 'x' FROM mdl_question_attempts WHERE behaviour = 'missing' LIMIT 0, 1
      

      It looks like it runs for every possible behaviour. When the question_attempts table is large, this can take a long time, causing extremely long load times on the plug-in overview page.Why do these queries run when you load that page and can we put an index on that field?

      explain SELECT 'x' FROM mdl_question_attempts WHERE behaviour = 'missing' LIMIT 0, 1;
      +------+-------------+-----------------------+------+---------------+------+---------+------+---------+-------------+
      | id   | select_type | table                 | type | possible_keys | key  | key_len | ref  | rows    | Extra       |
      +------+-------------+-----------------------+------+---------------+------+---------+------+---------+-------------+
      |    1 | SIMPLE      | mdl_question_attempts | ALL  | NULL          | NULL | NULL    | NULL | 3317019 | Using where |
      +------+-------------+-----------------------+------+---------------+------+---------+------+---------+-------------+
       
      SELECT 'x' FROM mdl_question_attempts WHERE behaviour = 'manualgraded' limit 0, 1;
       
      Empty set (1 min 29.28 sec)
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/Sep/14