Search code examples
mysqlexplainsql-execution-plan

MySQL EXPLAIN automatic analyzing


I need to implement automatic analyzing of output of the MySQL EXPLAIN command, which will mark queries as "bad" (if which don't use indexes, for example), "middle" (which can be optimized) and "good".

Are there any existing solutions or any algorithms to implement it?


Solution

  • Are there any existing solutions or any algorithms to implement it?

    Not that I know of, and there's probably a good reason for that, namely that it is not something (the analysis) that you can break down into a set of fixed rules.

    However, you could identify a few things, such as Using temporary; Using filesort and parse your plans for those terms.

    See here and here for more information.