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
cfbc545d
Commit
cfbc545d
authored
Feb 07, 2014
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
5b441013
34b6f51d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
4 deletions
+78
-4
mysql-test/r/subselect_sj2.result
mysql-test/r/subselect_sj2.result
+17
-0
mysql-test/r/subselect_sj2_jcl6.result
mysql-test/r/subselect_sj2_jcl6.result
+17
-0
mysql-test/r/subselect_sj2_mat.result
mysql-test/r/subselect_sj2_mat.result
+17
-0
mysql-test/t/subselect_sj2.test
mysql-test/t/subselect_sj2.test
+19
-0
sql/opt_subselect.cc
sql/opt_subselect.cc
+6
-2
sql/opt_subselect.h
sql/opt_subselect.h
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+1
-1
No files found.
mysql-test/r/subselect_sj2.result
View file @
cfbc545d
...
...
@@ -1112,5 +1112,22 @@ t3 AS t3a INNER JOIN t3 AS t3b ON ( t3a.i3 = t3b.i3 )
);
i1
DROP TABLE t1,t2,t3;
#
# MDEV-5582: Plugin 'MEMORY' has ref_count=1 after shutdown with materialization+semijoin
#
CREATE TABLE t1 (a INT) engine=innodb;
INSERT INTO t1 VALUES (8),(9);
CREATE TABLE t2 (b INT) engine=innodb;
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (c INT, INDEX(c)) engine=innodb;
INSERT INTO t2 VALUES (4),(5);
explain
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
a
DROP TABLE t1,t2,t3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
mysql-test/r/subselect_sj2_jcl6.result
View file @
cfbc545d
...
...
@@ -1127,6 +1127,23 @@ t3 AS t3a INNER JOIN t3 AS t3b ON ( t3a.i3 = t3b.i3 )
);
i1
DROP TABLE t1,t2,t3;
#
# MDEV-5582: Plugin 'MEMORY' has ref_count=1 after shutdown with materialization+semijoin
#
CREATE TABLE t1 (a INT) engine=innodb;
INSERT INTO t1 VALUES (8),(9);
CREATE TABLE t2 (b INT) engine=innodb;
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (c INT, INDEX(c)) engine=innodb;
INSERT INTO t2 VALUES (4),(5);
explain
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
a
DROP TABLE t1,t2,t3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
#
...
...
mysql-test/r/subselect_sj2_mat.result
View file @
cfbc545d
...
...
@@ -1114,6 +1114,23 @@ t3 AS t3a INNER JOIN t3 AS t3b ON ( t3a.i3 = t3b.i3 )
);
i1
DROP TABLE t1,t2,t3;
#
# MDEV-5582: Plugin 'MEMORY' has ref_count=1 after shutdown with materialization+semijoin
#
CREATE TABLE t1 (a INT) engine=innodb;
INSERT INTO t1 VALUES (8),(9);
CREATE TABLE t2 (b INT) engine=innodb;
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (c INT, INDEX(c)) engine=innodb;
INSERT INTO t2 VALUES (4),(5);
explain
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
a
DROP TABLE t1,t2,t3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
set optimizer_switch=default;
...
...
mysql-test/t/subselect_sj2.test
View file @
cfbc545d
...
...
@@ -1249,5 +1249,24 @@ SELECT * FROM t1 WHERE ( 1, 1 ) IN (
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# MDEV-5582: Plugin 'MEMORY' has ref_count=1 after shutdown with materialization+semijoin
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
engine
=
innodb
;
INSERT
INTO
t1
VALUES
(
8
),(
9
);
CREATE
TABLE
t2
(
b
INT
)
engine
=
innodb
;
INSERT
INTO
t2
VALUES
(
2
),(
3
);
CREATE
TABLE
t3
(
c
INT
,
INDEX
(
c
))
engine
=
innodb
;
INSERT
INTO
t2
VALUES
(
4
),(
5
);
explain
SELECT
*
FROM
t1
WHERE
9
IN
(
SELECT
b
FROM
t2
WHERE
1
IN
(
SELECT
MIN
(
c
)
FROM
t3
)
);
SELECT
*
FROM
t1
WHERE
9
IN
(
SELECT
b
FROM
t2
WHERE
1
IN
(
SELECT
MIN
(
c
)
FROM
t3
)
);
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
# This must be the last in the file:
set
optimizer_switch
=@
subselect_sj2_tmp
;
sql/opt_subselect.cc
View file @
cfbc545d
...
...
@@ -5234,9 +5234,9 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
through Item::cleanup() calls).
*/
void
cleanup_empty_jtbm_semi_joins
(
JOIN
*
join
)
void
cleanup_empty_jtbm_semi_joins
(
JOIN
*
join
,
List
<
TABLE_LIST
>
*
join_list
)
{
List_iterator
<
TABLE_LIST
>
li
(
*
join
->
join
_list
);
List_iterator
<
TABLE_LIST
>
li
(
*
join_list
);
TABLE_LIST
*
table
;
while
((
table
=
li
++
))
{
...
...
@@ -5248,6 +5248,10 @@ void cleanup_empty_jtbm_semi_joins(JOIN *join)
table
->
table
=
NULL
;
}
}
else
if
(
table
->
nested_join
&&
table
->
sj_subq_pred
)
{
cleanup_empty_jtbm_semi_joins
(
join
,
&
table
->
nested_join
->
join_list
);
}
}
}
...
...
sql/opt_subselect.h
View file @
cfbc545d
...
...
@@ -12,7 +12,7 @@ int pull_out_semijoin_tables(JOIN *join);
bool
optimize_semijoin_nests
(
JOIN
*
join
,
table_map
all_table_map
);
bool
setup_jtbm_semi_joins
(
JOIN
*
join
,
List
<
TABLE_LIST
>
*
join_list
,
Item
**
join_where
);
void
cleanup_empty_jtbm_semi_joins
(
JOIN
*
join
);
void
cleanup_empty_jtbm_semi_joins
(
JOIN
*
join
,
List
<
TABLE_LIST
>
*
join_list
);
// used by Loose_scan_opt
ulonglong
get_bound_sj_equalities
(
TABLE_LIST
*
sj_nest
,
...
...
sql/sql_select.cc
View file @
cfbc545d
...
...
@@ -10550,7 +10550,7 @@ void JOIN::cleanup(bool full)
}
if
(
full
)
{
cleanup_empty_jtbm_semi_joins
(
this
);
cleanup_empty_jtbm_semi_joins
(
this
,
join_list
);
/*
Ensure that the following delete_elements() would not be called
twice for the same list.
...
...
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