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

Performance improvement for where_clause_list

    XMLWordPrintable

    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.

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            bushido Mark Nielsen
            Integrator:
            Dan Poltawski
            Tester:
            Dan Poltawski
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

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