[MDEV-305] SHOW EXPLAIN: ref returned by SHOW EXPLAIN is different from the normal EXPLAIN ('const' vs empty string) Created: 2012-06-02  Updated: 2012-06-04  Resolved: 2012-06-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: 10.0.0

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-165 MWL#182: Explain running statements: ... Closed

 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



 Comments   
Comment by Sergei Petrunia [ 2012-06-04 ]

Fixed. Added comment about create_ref_for_key().

Generated at Thu Feb 08 06:27:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.