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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
189157d0
Commit
189157d0
authored
Jul 26, 2018
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.1' into bb-10.1-merge-sanja
parents
cb5952b5
1fde449f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
123 additions
and
0 deletions
+123
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+16
-0
mysql-test/r/subselect_no_exists_to_in.result
mysql-test/r/subselect_no_exists_to_in.result
+16
-0
mysql-test/r/subselect_no_mat.result
mysql-test/r/subselect_no_mat.result
+16
-0
mysql-test/r/subselect_no_opts.result
mysql-test/r/subselect_no_opts.result
+16
-0
mysql-test/r/subselect_no_scache.result
mysql-test/r/subselect_no_scache.result
+16
-0
mysql-test/r/subselect_no_semijoin.result
mysql-test/r/subselect_no_semijoin.result
+16
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+15
-0
sql/item.h
sql/item.h
+5
-0
sql/sql_select.cc
sql/sql_select.cc
+7
-0
No files found.
mysql-test/r/subselect.result
View file @
189157d0
...
...
@@ -7235,6 +7235,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
#
# MDEV-16820: impossible where with inexpensive subquery
#
create table t1 (a int) engine=myisam;
insert into t1 values (3), (1), (7);
create table t2 (b int, index idx(b));
insert into t2 values (2), (5), (3), (2);
explain select * from t1 where (select max(b) from t2) = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
...
...
mysql-test/r/subselect_no_exists_to_in.result
View file @
189157d0
...
...
@@ -7235,6 +7235,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
#
# MDEV-16820: impossible where with inexpensive subquery
#
create table t1 (a int) engine=myisam;
insert into t1 values (3), (1), (7);
create table t2 (b int, index idx(b));
insert into t2 values (2), (5), (3), (2);
explain select * from t1 where (select max(b) from t2) = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
...
...
mysql-test/r/subselect_no_mat.result
View file @
189157d0
...
...
@@ -7228,6 +7228,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
#
# MDEV-16820: impossible where with inexpensive subquery
#
create table t1 (a int) engine=myisam;
insert into t1 values (3), (1), (7);
create table t2 (b int, index idx(b));
insert into t2 values (2), (5), (3), (2);
explain select * from t1 where (select max(b) from t2) = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
...
...
mysql-test/r/subselect_no_opts.result
View file @
189157d0
...
...
@@ -7226,6 +7226,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
#
# MDEV-16820: impossible where with inexpensive subquery
#
create table t1 (a int) engine=myisam;
insert into t1 values (3), (1), (7);
create table t2 (b int, index idx(b));
insert into t2 values (2), (5), (3), (2);
explain select * from t1 where (select max(b) from t2) = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
...
...
mysql-test/r/subselect_no_scache.result
View file @
189157d0
...
...
@@ -7241,6 +7241,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
#
# MDEV-16820: impossible where with inexpensive subquery
#
create table t1 (a int) engine=myisam;
insert into t1 values (3), (1), (7);
create table t2 (b int, index idx(b));
insert into t2 values (2), (5), (3), (2);
explain select * from t1 where (select max(b) from t2) = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
...
...
mysql-test/r/subselect_no_semijoin.result
View file @
189157d0
...
...
@@ -7226,6 +7226,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
#
# MDEV-16820: impossible where with inexpensive subquery
#
create table t1 (a int) engine=myisam;
insert into t1 values (3), (1), (7);
create table t2 (b int, index idx(b));
insert into t2 values (2), (5), (3), (2);
explain select * from t1 where (select max(b) from t2) = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
...
...
mysql-test/t/subselect.test
View file @
189157d0
...
...
@@ -6098,6 +6098,21 @@ and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
SET
@@
optimizer_switch
=
@
optimiser_switch_save
;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# MDEV-16820: impossible where with inexpensive subquery
--
echo
#
create
table
t1
(
a
int
)
engine
=
myisam
;
insert
into
t1
values
(
3
),
(
1
),
(
7
);
create
table
t2
(
b
int
,
index
idx
(
b
));
insert
into
t2
values
(
2
),
(
5
),
(
3
),
(
2
);
explain
select
*
from
t1
where
(
select
max
(
b
)
from
t2
)
=
10
;
explain
select
*
from
t1
where
(
select
max
(
b
)
from
t2
)
=
10
and
t1
.
a
>
3
;
drop
table
t1
,
t2
;
--
echo
End
of
5.5
tests
--
echo
# End of 10.0 tests
...
...
sql/item.h
View file @
189157d0
...
...
@@ -1449,6 +1449,11 @@ class Item: public Value_source,
virtual
bool
exists2in_processor
(
uchar
*
opt_arg
)
{
return
0
;
}
virtual
bool
find_selective_predicates_list_processor
(
uchar
*
opt_arg
)
{
return
0
;
}
bool
cleanup_is_expensive_cache_processor
(
uchar
*
arg
)
{
is_expensive_cache
=
(
int8
)(
-
1
);
return
0
;
}
/* To call bool function for all arguments */
struct
bool_func_call_args
...
...
sql/sql_select.cc
View file @
189157d0
...
...
@@ -1212,6 +1212,13 @@ JOIN::optimize_inner()
if
(
optimize_constant_subqueries
())
DBUG_RETURN
(
1
);
if
(
conds
&&
conds
->
has_subquery
())
(
void
)
conds
->
walk
(
&
Item
::
cleanup_is_expensive_cache_processor
,
0
,
(
uchar
*
)
0
);
if
(
having
&&
having
->
has_subquery
())
(
void
)
having
->
walk
(
&
Item
::
cleanup_is_expensive_cache_processor
,
0
,
(
uchar
*
)
0
);
if
(
setup_jtbm_semi_joins
(
this
,
join_list
,
&
conds
))
DBUG_RETURN
(
1
);
...
...
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