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

pre-cache active filters for course categories to significantly reduce database queries

XMLWordPrintable

    • MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Hide
      • have 500 course categories
      • enable multilang filter for content and headings (which allows course category names to be multilingual)
      • go to course/index.php or course/category.php
      • with page-bottom stats enabled, see how many db queries it takes to load these pages
      • apply the commit, and retest. Db queries should be reduced by approximately the number of course categories.
      Show
      have 500 course categories enable multilang filter for content and headings (which allows course category names to be multilingual) go to course/index.php or course/category.php with page-bottom stats enabled, see how many db queries it takes to load these pages apply the commit, and retest. Db queries should be reduced by approximately the number of course categories.
    • 20
    • FRONTEND Sprint 7

      On Moodles that have a lot of course categories, and a filter enabled for content and headings (e.g. multilang), there are currently excessively many database queries being made (e.g. 1 per course category). For example, if you have 500 course categories, which is often the case for large institutions, you will have > 500 queries on course/index.php or course/category.php.

      The database queries are caused by a call to get the context instance for each course category.

      I've coded something in the branch https://github.com/brki/moodle/tree/mdl23-preload-filters-for-course-categories . The commit https://github.com/brki/moodle/commit/da23cce06d7edbd2cad43ba9c25396dcf5bfac35 preloads all the course category context instances for course/index.php and course/category.php. This reduces the database queries significantly (it makes two database queries to get all of the course category contexts instead of one for every course category).

            Unassigned Unassigned
            brianking Brian King
            Damyon Wiese Damyon Wiese
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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