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

Custom reports are inefficient in requesting persistent element data

    XMLWordPrintable

Details

    • MOODLE_400_STABLE
    • MOODLE_402_STABLE
    • Hide

      Automated (both Behat & PHPUnit) will test everything still works

      Manual test prerequisites

      1. MySQL (or the knowledge to enable query logging on another DB )
        • Root CLI access to database

      Manual test

      1. Log in to MySQL terminal as root user, issue the following commands:

        mysql> SET global log_output = 'FILE';
        Query OK, 0 rows affected (0.00 sec)
         
        mysql> SET global general_log_file='/tmp/mysql.log';
        Query OK, 0 rows affected (0.01 sec)
         
        mysql> SET global general_log = 1;
        Query OK, 0 rows affected (0.00 sec)
         
        mysql> quit
        Bye
        

      2. Tail the resulting log file:

        $ tail -f /tmp/mysql.log
        

      3. Log in to Moodle as admin
      4. Navigate to Reports from user menu
      5. Create new report from Users report source
        • Include default setup
      6. Examine the DB query log for the last page request
        • Confirm there is only one logged query matching FROM m_reportbuilder_column (down from ~10)
        • Confirm there are only two logged queries matching FROM m_reportbuilder_filter (down from ~7)
        • Note: replace m_ in table names with appropriate $CFG->prefix according to your own site
      Show
      Automated (both Behat & PHPUnit) will test everything still works Manual test prerequisites MySQL (or the knowledge to enable query logging on another DB ) Root CLI access to database Manual test Log in to MySQL terminal as root user, issue the following commands: mysql> SET global log_output = 'FILE'; Query OK, 0 rows affected (0.00 sec)   mysql> SET global general_log_file='/tmp/mysql.log'; Query OK, 0 rows affected (0.01 sec)   mysql> SET global general_log = 1; Query OK, 0 rows affected (0.00 sec)   mysql> quit Bye Tail the resulting log file: $ tail -f /tmp/mysql.log Log in to Moodle as admin Navigate to Reports from user menu Create new report from Users report source Include default setup Examine the DB query log for the last page request Confirm there is only one logged query matching FROM m_reportbuilder_column (down from ~10) Confirm there are only two logged queries matching FROM m_reportbuilder_filter (down from ~7) Note: replace m_ in table names with appropriate $CFG->prefix according to your own site
    • WP Sprint 2023-I1.1 (David)

    Description

      When a custom report is loaded, it loads it's column persistents multiple times per request - see all calls in the corresponding table class) (& also multiple times during unit tests, which needs fixing for better deprecation debugging in MDL-76900)

      See also WP-1406 from Workplace project

      Attachments

        1. mdl76901.png
          mdl76901.png
          309 kB
        2. sqllog.txt
          36 kB

        Issue Links

          Activity

            People

              pholden Paul Holden
              pholden Paul Holden
              Carlos Castillo Carlos Castillo
              David Matamoros David Matamoros
              Ron Carl Alfon Yu Ron Carl Alfon Yu
              Carlos Castillo, David Matamoros, Mikel Martín Corrales, Paul Holden
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                24/Apr/23

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 5 hours, 1 minute
                  1d 5h 1m