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

Logically invalid SQL

XMLWordPrintable

    • MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • Hide

      Do a quick regression test on grade history report. If you have significant gradebook history, you should notice slight performance increase

      Show
      Do a quick regression test on grade history report. If you have significant gradebook history, you should notice slight performance increase

      There is a logically-flawed join in the grade history report (/grade/report/history/classes/output/tablelog.php @ 416).

      • We ALWAYS filter on gi.courseid (see line 330 in get_filters_sql_and_params)
      • We LEFT JOIN grade_items gi

      This doesn't make sense as a grade_items row will ALWAYS be required due to the filter on gi.courseid (Left joins include null rows and null can never be equal to a courseid).

      Therefore..

      LEFT JOIN grade_items gi ON gi.id = ggh.itemid
      

      should become:

      JOIN grade_items gi ON gi.id = ggh.itemid
      

      This doesn't actually make any noticeable difference, but should help optimisers pick better query paths.

            skylarkelty Skylar Kelty
            skylarkelty Skylar Kelty
            Ankit Agarwal Ankit Agarwal
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Rajesh Taneja Rajesh Taneja
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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