Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-27294

Implement EXPLAIN for SHOW

    XMLWordPrintable

Details

    Description

      EXPLAIN currently supports SELECT queries that target information_schema tables. For example, these queries are valid:

      EXPLAIN SELECT * FROM information_schema.TABLES 
         WHERE TABLE_SCHEMA='db1';
       
      EXPLAIN SELECT * FROM information_schema.TRIGGERS 
         WHERE EVENT_OBJECT_SCHEMA='db1';
       
      EXPLAIN SELECT * FROM information_schema.GLOBAL_VARIABLES 
         WHERE VARIABLE_NAME='character_set_server';
      

      Sometimes this functionality is very important, because innocent-looking SELECT queries that target information_schema tables can actually cause serious performance issues. For example, see here:

      https://dev.mysql.com/doc/refman/5.7/en/information-schema-optimization.html

      However, one problem is that if we convert the above SELECT queries to their equivalent SHOW queries, then EXPLAIN fails. For example:

      EXPLAIN SHOW TABLE STATUS 
         FROM db1;
       
      EXPLAIN SHOW TRIGGERS 
         FROM db1;
       
      EXPLAIN SHOW GLOBAL VARIABLES 
         WHERE VARIABLE_NAME='character_set_server';
      

      Some of these SHOW queries can probably have similar problems as SELECT queries that target information_schema tables.

      If so, then wouldn't it make sense to implement EXPLAIN for them as well?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.