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

Further performance improvement for get_user_access_sitewide()

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • None
    • 1.9.13, 2.0.4, 2.1.1, 2.2
    • Libraries
    • MySQL 5.1 on Ubuntu 10.04
    • MySQL
    • MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Hide

      Test for functional regressions only - performance improvement is hard to test without a large database.

      Create a course with a News forum and several participants. Create a message in the forum and run cron. Verfiy that cron runs and sends out messages via e-mail.

      Show
      Test for functional regressions only - performance improvement is hard to test without a large database. Create a course with a News forum and several participants. Create a message in the forum and run cron. Verfiy that cron runs and sends out messages via e-mail.

      The function get_user_access_sitewide() in access.php uses a very expensive DB query with a three-level JOIN. It was optimized in MDL-15748 by adding the following additional condition in the WHERE clause:

      ctx.contextlevel <= 40

      Even with this improvement, it runs very slowly on systems with a large number of user-level role assignments (Mentor role). My suggestion is to optimize the query further by changing the above condition to:

      ctx.contextlevel = 10 OR ctx.contextlevel = 40

      For details, see http://moodle.org/mod/forum/discuss.php?d=184624 .

            Unassigned Unassigned
            bostelm Henning Bostelmann
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            5 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:

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