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

SHOW EXPLAIN: ref returned by SHOW EXPLAIN is different from the normal EXPLAIN ('const' vs empty string)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 10.0.0
    • None
    • None

    Description

      EXPLAIN SELECT SLEEP(0.5) FROM t1 WHERE a=1;
      id      1
      select_type     SIMPLE
      table   t1
      type    ref
      possible_keys   a
      key     a
      key_len 5
      ref     const
      rows    1
      Extra   Using index
      SELECT SLEEP(0.5) FROM t1 WHERE a=1;

      SHOW EXPLAIN FOR 2;
      id      1
      select_type     SIMPLE
      table   t1
      type    ref
      possible_keys   a
      key     a
      key_len 5
      ref
      rows    1
      Extra   Using index
      Warnings:
      Level   Note
      Code    1003
      Message SELECT SLEEP(0.5) FROM t1 WHERE a=1

      bzr version-info

      revision-id: psergey@askmonty.org-20120524182239-gq6jtnnovydnthtl
      date: 2012-05-24 22:22:39 +0400
      revno: 3405

      Reproducible with the default optimizer_switch as well as with all OFF values.
      Reproducible with MyISAM, Aria, InnoDB.

      Test case:

      CREATE TABLE t1 (a INT, KEY(a));
      INSERT INTO t1 VALUES
      (3),(1),(5),(1);
       
      --connect (con1,localhost,root,,)
      let $con_id = `SELECT CONNECTION_ID()`;
       
      EXPLAIN SELECT SLEEP(0.5) FROM t1 WHERE a=1;
      --send
      SELECT SLEEP(0.5) FROM t1 WHERE a=1;
       
      --connection default
      let $run = 100;
      while ($run)
      {
        --error 0,ER_ERROR_WHEN_EXECUTING_COMMAND
        --eval SHOW EXPLAIN FOR $con_id
        --dec $run
        if (!$mysql_errno)
        {
          let $run = 0;
        }
      }
       
      --connection con1
      --reap

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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