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

Slow query in /admin/index.php

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      1/ Access /admin/index.php on a Moodle instance running on MySQL
      2/ manually convert some table to MyISAM engine
      3/ Access /admin/index.php again and verify warning is displayed

      optionally: Check the slow query log for the "SHOW TABLE STATUS" query

      Show
      1/ Access /admin/index.php on a Moodle instance running on MySQL 2/ manually convert some table to MyISAM engine 3/ Access /admin/index.php again and verify warning is displayed optionally: Check the slow query log for the "SHOW TABLE STATUS" query
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w28_MDL-34010_m24_mysqldiag

      Description

      After upgrading to Moodle 2, we're seeing a slow query in our MySQL slow query log every time we access /admin/index.php:

      SHOW TABLE STATUS WHERE Name LIKE BINARY 'mdl_%';

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            maherne Michael Aherne added a comment -

            Attached is a pull request which updates the code to use information_schema.tables instead of "SHOW STATUS". On our server this executes almost instantly as opposed to over 6 seconds which the original query took.

            Show
            maherne Michael Aherne added a comment - Attached is a pull request which updates the code to use information_schema.tables instead of "SHOW STATUS". On our server this executes almost instantly as opposed to over 6 seconds which the original query took.
            Hide
            poltawski Dan Poltawski added a comment -

            Thanks for the patch Michael!

            Show
            poltawski Dan Poltawski added a comment - Thanks for the patch Michael!
            Hide
            poltawski Dan Poltawski added a comment -

            Petr,

            What do you think of this patch?

            Show
            poltawski Dan Poltawski added a comment - Petr, What do you think of this patch?
            Hide
            skodak Petr Skoda added a comment -

            +1, we did something similar in other places alrady

            Show
            skodak Petr Skoda added a comment - +1, we did something similar in other places alrady
            Hide
            skodak Petr Skoda added a comment -

            Hmm, maybe it would be even faster if we verified the Engine='MyISAM' directly in sql and just counted number of tables there.

            Show
            skodak Petr Skoda added a comment - Hmm, maybe it would be even faster if we verified the Engine='MyISAM' directly in sql and just counted number of tables there.
            Hide
            skodak Petr Skoda added a comment -

            I have added one more commit that adds count() on top of your patch, thanks for the report and patch

            to integrators: feel free to cherry pick to 2.3

            Show
            skodak Petr Skoda added a comment - I have added one more commit that adds count() on top of your patch, thanks for the report and patch to integrators: feel free to cherry pick to 2.3
            Hide
            poltawski Dan Poltawski added a comment -

            Taking integration held issues out of integration (whilst we are keeping master and 23_STABLE in sync).

            Show
            poltawski Dan Poltawski added a comment - Taking integration held issues out of integration (whilst we are keeping master and 23_STABLE in sync).
            Hide
            poltawski Dan Poltawski added a comment -

            Integrated to master, thanks guys

            Show
            poltawski Dan Poltawski added a comment - Integrated to master, thanks guys
            Hide
            ankit_frenz Ankit Agarwal added a comment -

            This works as expected!
            Thanks

            Show
            ankit_frenz Ankit Agarwal added a comment - This works as expected! Thanks
            Hide
            poltawski Dan Poltawski added a comment -

            Congratulations!

            You've made it into the weekly release!

            Thanks for your contribution - here are some random drummers to keep you inspired for the next week!
            http://www.youtube.com/watch?v=_QhpHUmVCmY

            Show
            poltawski Dan Poltawski added a comment - Congratulations! You've made it into the weekly release! Thanks for your contribution - here are some random drummers to keep you inspired for the next week! http://www.youtube.com/watch?v=_QhpHUmVCmY

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/12