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

Calendar executes too many db queries

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.3, 3.4
    • Fix Version/s: 3.3.4, 3.4.1
    • Component/s: Calendar, Groups
    • Labels:
    • Testing Instructions:
      Hide
      1. Download the file create_users_courses_groups_assignments.php and put it in Moodle's root directory
      2. Run the above file (php create_users_courses_groups_assignments). This will create 500 courses each of which contains an assignment and some groups, create some students and courses in the course.
      3. BEFORE APPLYING THE PATCH, log in using one of the new students the above script created. For example use (username: s1, password: test). This user should be enrolled in many courses.
      4. Take a note of the performance information. in particular, number of DB reads and writes.
      5. APPLY THE PATCH and repeats steps 3 and 4.
      6. The number of DB reads should be dropped by nearly 30%
      Show
      Download the file  create_users_courses_groups_assignments.php  and put it in Moodle's root directory Run the above file (php create_users_courses_groups_assignments). This will create 500 courses each of which contains an assignment and some groups, create some students and courses in the course. BEFORE APPLYING THE PATCH, log in using one of the new students the above script created. For example use (username: s1, password: test). This user should be enrolled in many courses. Take a note of the performance information. in particular, number of DB reads and writes. APPLY THE PATCH and repeats steps 3 and 4. The number of DB reads should be dropped by nearly 30%
    • Affected Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-60188-master

      Description

      The calendar calls the function groups_get_user_groups quite often, which executes one database query each time.

      When a user is enrolled in 130 courses, I observed that the dashboard generates about 1200 queries, 920 of these thanks to the calendar calling groups_get_user_groups.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rezaie9 Shamim Rezaie
              Reporter:
              mgauk Martin Gauk
              Peer reviewer:
              Simey Lameze
              Integrator:
              Damyon Wiese
              Tester:
              Damyon Wiese
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              4 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Jan/18