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

Use indexed field when deleting completion criteria

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Add a course module to a course
      Go to course completion and tick this activity as a requirement for course completion
      Verify rows were added to the course_completion_criteria table for it.
      Delete the course module from the course editing screen.
      Verify the rows in the course_completion_criteria table were deleted.

      Show
      Add a course module to a course Go to course completion and tick this activity as a requirement for course completion Verify rows were added to the course_completion_criteria table for it. Delete the course module from the course editing screen. Verify the rows in the course_completion_criteria table were deleted.
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE, MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Whenever a course module is deleted, it's related mdl_course_completion_criteria records are deleted. However, the conditions used in the DELETE statement don't use the indexed field in that table.

      As such, on larger instances, the delete query can take awhile as it has to perform a scan of the whole table rather than on the index.

      In one database with 20M rows in this table, the DELETE statement currently takes a full 2 seconds. This is masked from the end-user since it goes through an Ajax request to course/rest.php, but its obviously beneficial to make this easier on the database.

      We already have the full course module record available to us where the delete is performed, so this change simply adds the course field to the delete query (which is an indexed field on that table).

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Jul/16