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

Integers inserted in SQL queries as quoted strings confusing MySQL query optimiser

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.4.1
    • Fix Version/s: None
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Affected Branches:
      MOODLE_34_STABLE

      Description

      The SQL statement builder is passing numeric parameters to prepared statements as quoted strings, making the query optimizer (MySQL) to ignore the indexed numeric fields and there are hundreds of unused indices as reported by the MySQL statistics. I consider this to affect other databases as well.

      Examples include the auto-increment field id of any table, courseid, userid etc.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated: