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
c25728cd
Commit
c25728cd
authored
Jun 27, 2011
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More semi-join + outer-join testcases.
parent
d3fc6695
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
3 deletions
+150
-3
mysql-test/r/subselect_sj.result
mysql-test/r/subselect_sj.result
+56
-1
mysql-test/r/subselect_sj_jcl6.result
mysql-test/r/subselect_sj_jcl6.result
+56
-1
mysql-test/t/subselect_sj.test
mysql-test/t/subselect_sj.test
+38
-1
No files found.
mysql-test/r/subselect_sj.result
View file @
c25728cd
...
...
@@ -1391,6 +1391,7 @@ create table t0 (a int);
insert into t0 values (1),(2);
set @tmp_20110622= @@optimizer_switch;
set optimizer_switch='firstmatch=off,loosescan=off,materialization=off';
# Check DuplicateWeedout + join buffer
explain
select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
id select_type table type possible_keys key key_len ref rows Extra
...
...
@@ -1401,7 +1402,7 @@ select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
a
1
2
#
Try also
without join buffer
#
Check DuplicateWeedout
without join buffer
set @tmp_jcl_20110622= @@join_cache_level;
set join_cache_level= 0;
explain
...
...
@@ -1414,6 +1415,7 @@ select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
a
1
2
# Check FirstMatch without join buffer:
set optimizer_switch='firstmatch=on';
explain
select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
...
...
@@ -1425,7 +1427,60 @@ select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
a
1
2
#
# Now, check the same for multiple inner tables:
alter table t2 add b int;
update t2 set b=a;
create table t3 as select * from t2;
set optimizer_switch='firstmatch=off';
set join_cache_level= 0;
# DuplicateWeedout without join buffer
explain
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t0 ALL NULL NULL NULL NULL 2
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary
1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
a
1
2
set @@join_cache_level=@tmp_jcl_20110622;
# DuplicateWeedout + join buffer
explain
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t0 ALL NULL NULL NULL NULL 2 Start temporary
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
a
1
2
# Now, let the inner join side have a 'partial' match
select * from t3;
a b
1 1
insert into t3 values(2,2);
explain
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t0 ALL NULL NULL NULL NULL 2 Start temporary
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t2 ALL NULL NULL NULL NULL 1
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
a
1
2
set @@optimizer_switch=@tmp_20110622;
drop table t0, t1, t2;
set @@optimizer_switch=@save_optimizer_switch;
mysql-test/r/subselect_sj_jcl6.result
View file @
c25728cd
...
...
@@ -1399,6 +1399,7 @@ create table t0 (a int);
insert into t0 values (1),(2);
set @tmp_20110622= @@optimizer_switch;
set optimizer_switch='firstmatch=off,loosescan=off,materialization=off';
# Check DuplicateWeedout + join buffer
explain
select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
id select_type table type possible_keys key key_len ref rows Extra
...
...
@@ -1409,7 +1410,7 @@ select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
a
1
2
#
Try also
without join buffer
#
Check DuplicateWeedout
without join buffer
set @tmp_jcl_20110622= @@join_cache_level;
set join_cache_level= 0;
explain
...
...
@@ -1422,6 +1423,7 @@ select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
a
1
2
# Check FirstMatch without join buffer:
set optimizer_switch='firstmatch=on';
explain
select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
...
...
@@ -1433,7 +1435,60 @@ select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
a
1
2
#
# Now, check the same for multiple inner tables:
alter table t2 add b int;
update t2 set b=a;
create table t3 as select * from t2;
set optimizer_switch='firstmatch=off';
set join_cache_level= 0;
# DuplicateWeedout without join buffer
explain
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t0 ALL NULL NULL NULL NULL 2
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary
1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
a
1
2
set @@join_cache_level=@tmp_jcl_20110622;
# DuplicateWeedout + join buffer
explain
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t0 ALL NULL NULL NULL NULL 2 Start temporary
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary; Using join buffer (incremental, BNL join)
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
a
1
2
# Now, let the inner join side have a 'partial' match
select * from t3;
a b
1 1
insert into t3 values(2,2);
explain
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t0 ALL NULL NULL NULL NULL 2 Start temporary
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (incremental, BNL join)
select * from t0
where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
a
1
2
set @@optimizer_switch=@tmp_20110622;
drop table t0, t1, t2;
set @@optimizer_switch=@save_optimizer_switch;
...
...
mysql-test/t/subselect_sj.test
View file @
c25728cd
...
...
@@ -1280,11 +1280,12 @@ insert into t0 values (1),(2);
set
@
tmp_20110622
=
@@
optimizer_switch
;
set
optimizer_switch
=
'firstmatch=off,loosescan=off,materialization=off'
;
--
echo
# Check DuplicateWeedout + join buffer
explain
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
t2
on
t1
.
a
=
t2
.
a
);
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
t2
on
t1
.
a
=
t2
.
a
);
--
echo
#
Try also
without join buffer
--
echo
#
Check DuplicateWeedout
without join buffer
set
@
tmp_jcl_20110622
=
@@
join_cache_level
;
set
join_cache_level
=
0
;
explain
...
...
@@ -1292,12 +1293,48 @@ select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
t2
on
t1
.
a
=
t2
.
a
);
--
echo
# Check FirstMatch without join buffer:
set
optimizer_switch
=
'firstmatch=on'
;
explain
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
t2
on
t1
.
a
=
t2
.
a
);
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
t2
on
t1
.
a
=
t2
.
a
);
--
echo
#
--
echo
# Now, check the same for multiple inner tables:
alter
table
t2
add
b
int
;
update
t2
set
b
=
a
;
create
table
t3
as
select
*
from
t2
;
set
optimizer_switch
=
'firstmatch=off'
;
set
join_cache_level
=
0
;
--
echo
# DuplicateWeedout without join buffer
explain
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
(
t3
join
t2
on
t3
.
b
=
t2
.
b
)
on
t1
.
a
=
t3
.
a
);
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
(
t3
join
t2
on
t3
.
b
=
t2
.
b
)
on
t1
.
a
=
t3
.
a
);
set
@@
join_cache_level
=@
tmp_jcl_20110622
;
--
echo
# DuplicateWeedout + join buffer
explain
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
(
t3
join
t2
on
t3
.
b
=
t2
.
b
)
on
t1
.
a
=
t3
.
a
);
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
(
t3
join
t2
on
t3
.
b
=
t2
.
b
)
on
t1
.
a
=
t3
.
a
);
--
echo
# Now, let the inner join side have a 'partial' match
select
*
from
t3
;
insert
into
t3
values
(
2
,
2
);
explain
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
(
t3
join
t2
on
t3
.
b
=
t2
.
b
)
on
t1
.
a
=
t3
.
a
);
select
*
from
t0
where
a
in
(
select
t1
.
a
from
t1
left
join
(
t3
join
t2
on
t3
.
b
=
t2
.
b
)
on
t1
.
a
=
t3
.
a
);
set
@@
optimizer_switch
=@
tmp_20110622
;
drop
table
t0
,
t1
,
t2
;
...
...
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