Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f5fba656
Commit
f5fba656
authored
Oct 04, 2013
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-411: (different results for EXPLAIN and SHOW EXPLAIN)
- Added a testcase
parent
5e4044e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
1 deletion
+75
-1
mysql-test/r/show_explain.result
mysql-test/r/show_explain.result
+39
-0
mysql-test/t/show_explain.test
mysql-test/t/show_explain.test
+36
-1
No files found.
mysql-test/r/show_explain.result
View file @
f5fba656
...
...
@@ -1130,6 +1130,45 @@ set names default;
#
show explain for foo;
ERROR HY000: You may only use constant expressions in this statement
#
# MDEV-411: SHOW EXPLAIN: For dependent subquery EXPLAIN produces type=index, key, 'Using where; Using index',
# while SHOW EXPLAIN says type=ALL, no key, 'Range checked for each record'
#
CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (7),(0);
CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t2 VALUES (0),(8);
explain
SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2
WHERE b <= ANY (
SELECT a FROM t1
WHERE a = b + SLEEP(0.2) OR a >= ( SELECT SUM(b) FROM t2 ));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using index
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t1 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1)
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2
WHERE b <= ANY (
SELECT a FROM t1
WHERE a = b + SLEEP(0.2) OR a >= ( SELECT SUM(b) FROM t2 ));
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using index
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t1 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1)
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
Warnings:
Note 1003 SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2
WHERE b <= ANY (
SELECT a FROM t1
WHERE a = b + SLEEP(0.2) OR a >= ( SELECT SUM(b) FROM t2 ))
SUM(b)
0
set debug_dbug=@old_debug;
DROP TABLE t1,t2;
# End
drop table t0;
set debug_sync='RESET';
mysql-test/t/show_explain.test
View file @
f5fba656
...
...
@@ -1128,9 +1128,44 @@ set names default;
--
error
ER_SET_CONSTANTS_ONLY
show
explain
for
foo
;
--
echo
#
--
echo
# MDEV-411: SHOW EXPLAIN: For dependent subquery EXPLAIN produces type=index, key, 'Using where; Using index',
--
echo
# while SHOW EXPLAIN says type=ALL, no key, 'Range checked for each record'
--
echo
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
,
KEY
(
a
))
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
7
),(
0
);
CREATE
TABLE
t2
(
b
INT
NOT
NULL
)
ENGINE
=
MyISAM
;
INSERT
INTO
t2
VALUES
(
0
),(
8
);
explain
SELECT
SUM
(
b
)
FROM
(
SELECT
*
FROM
t1
)
AS
alias1
,
t2
WHERE
b
<=
ANY
(
SELECT
a
FROM
t1
WHERE
a
=
b
+
SLEEP
(
0.2
)
OR
a
>=
(
SELECT
SUM
(
b
)
FROM
t2
));
set
@
show_explain_probe_select_id
=
1
;
set
debug_dbug
=
'+d,show_explain_probe_join_exec_start'
;
send
SELECT
SUM
(
b
)
FROM
(
SELECT
*
FROM
t1
)
AS
alias1
,
t2
WHERE
b
<=
ANY
(
SELECT
a
FROM
t1
WHERE
a
=
b
+
SLEEP
(
0.2
)
OR
a
>=
(
SELECT
SUM
(
b
)
FROM
t2
));
connection
default
;
--
source
include
/
wait_condition
.
inc
evalp
show
explain
for
$thr2
;
connection
con1
;
reap
;
set
debug_dbug
=@
old_debug
;
DROP
TABLE
t1
,
t2
;
--
echo
# End
drop
table
t0
;
connection
default
;
disconnect
con1
;
set
debug_sync
=
'RESET'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment