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

Performance improvement for where_clause_list

    Details

      Description

      In Moodle 1.9, the database *_list() methods used IN, but in Moodle 2.X, they use OR. We have noticed that when using a very large list of items (EG: ~500), that ORs are slower than using an IN. This might also be true for other scenarios (EG: fewer list items, but much larger table, etc)

      Suggested changes:

      • Instead of using OR, use IN. There is one trick here though and that's NULLs. So, if there is a NULL value, the end result should probably look like: ($field IS NULL OR $field IN(...))
      • Make sure the values are unique and there are no duplicates.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Sep/12