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

Add component to tag_instance sql in question backup definition so taggeditem index is used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 3.5.6, 3.6.4
    • 3.5.2, 3.5.5, 3.6.3
    • Questions

    Description

      The class \backup_questions_structure_step found in backup/moodle2/backup_stepslib.php has a DB query for getting the tag instances associated with a question:

               $tag->set_source_sql("SELECT t.id, ti.contextid, t.name, t.rawname
                                    FROM {tag} t
                                    JOIN {tag_instance} ti ON ti.tagid = t.id
                                    WHERE ti.itemid = ?
                                    AND ti.itemtype = 'question'", array(backup::VAR_PARENTID));
      

      This query seems to be costly because it's not using a better index. You can test when running EXPLAIN:

       

      After some digging, the taglookup index is used if the component is specified:

       

      Attachments

        Activity

          People

            dvdcastro David Castro
            dvdcastro David Castro
            Mark Nelson Mark Nelson
            Jun Pataleta Jun Pataleta
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h

                Clockify

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