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

Avoid get_recordset performance hit in filter_get_active_in_context

XMLWordPrintable

      I noticed that filter_get_active_in_context in filterlib was using get_recordset_sql without a row limit, just because it was not very easy to get a unique value in the first column.

      However, it is known than get_recordset_sql is almost always slower than get_records, because (on postgres at least), even for small results, it does two network round trips to the DB server, rather than just one.

      Having re-witten the DB query in this function, it gives about a 20% speed-up, which seems worth having, so I am putting this up for review.

        1. filter_get_active_in_context_compare.php
          3 kB
        2. MDL-82606_403.webm
          1.20 MB
        3. MDL-82606_404.webm
          1.76 MB
        4. MDL-82606_main.webm
          1.13 MB
        5. test.php
          6 kB
        6. test-1.php
          3 kB
        7. test-2.php
          5 kB
        8. test-3.php
          5 kB

            timhunt Tim Hunt
            timhunt Tim Hunt
            Sam Marshall Sam Marshall
            Jun Pataleta Jun Pataleta
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 55 minutes
                55m

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