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

Improve the performance of mysqli_native_moodle_database->get_tables

    XMLWordPrintable

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Prerequesists: Moodle install with MySQL, create some random tables with a different prefix to that of your moodle install. So the database should contain a mix of tables with Moodle prefix (e.g. mdl_) and some non-prefixed tables.

      1. Run all phpunit tests
      2. Don manual verification using a script: It can also be tested wit a very simple php script like that:

        require_once('config.php');
        $tables = $DB->get_tables();
        var_dump($tables);

      3. The $tables variable from the code above should be an array containing all prefixed tables and none of the non-prefixed ones.
      Show
      Prerequesists: Moodle install with MySQL, create some random tables with a different prefix to that of your moodle install. So the database should contain a mix of tables with Moodle prefix (e.g. mdl_) and some non-prefixed tables. Run all phpunit tests Don manual verification using a script: It can also be tested wit a very simple php script like that: require_once('config.php'); $tables = $DB->get_tables(); var_dump($tables); The $tables variable from the code above should be an array containing all prefixed tables and none of the non-prefixed ones.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      get_tables function first executes "SHOW TABLES" and then filters out all tables not starting with $this->prefix. Instead, SHOW TABLES LIKE "{$this->prefix}%" would be much more efficient - especially in the situations where there is a lot of tables without $this->prefix prefix (e.g. Moodle & some other application share the same database).

        Attachments

          Activity

            People

            Assignee:
            tmuras Tomasz Muras
            Reporter:
            tmuras Tomasz Muras
            Integrator:
            Dan Poltawski
            Tester:
            Jason Fowler
            Participants:
            Component watchers:
            Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              25/Jun/12