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
49552cf1
Commit
49552cf1
authored
Apr 25, 2017
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '5.5' into bb-10.0-merge-5.5
parents
57fea99e
2e7ba70a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
6 deletions
+50
-6
mysql-test/r/subselect_innodb.result
mysql-test/r/subselect_innodb.result
+14
-0
mysql-test/t/subselect_innodb.test
mysql-test/t/subselect_innodb.test
+21
-0
sql/sql_select.cc
sql/sql_select.cc
+15
-6
No files found.
mysql-test/r/subselect_innodb.result
View file @
49552cf1
...
...
@@ -511,6 +511,20 @@ set join_cache_level = default;
drop view v1;
drop table t1,t2;
#
# MDEV-10693: cost-based choice between materialization and in-to-exists
# for a subquery from the expression used in ref access
#
CREATE TABLE t1 (i1 INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (i2 INT) ENGINE=InnoDB;
CREATE TABLE t3 (i3 INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t3 VALUES (3);
SELECT * FROM t1
WHERE NULL IN ( SELECT i2 FROM t2
WHERE i1 IN ( i2 IN ( SELECT i3 FROM t3 ) ) AND i2 = 2 );
i1
DROP TABLE t1,t2,t3;
#
# MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding
#
create table t1(a int) engine=innodb;
...
...
mysql-test/t/subselect_innodb.test
View file @
49552cf1
...
...
@@ -502,6 +502,27 @@ set join_cache_level = default;
drop
view
v1
;
drop
table
t1
,
t2
;
--
echo
#
--
echo
# MDEV-10693: cost-based choice between materialization and in-to-exists
--
echo
# for a subquery from the expression used in ref access
--
echo
#
--
source
include
/
have_innodb
.
inc
CREATE
TABLE
t1
(
i1
INT
PRIMARY
KEY
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
1
),(
2
);
CREATE
TABLE
t2
(
i2
INT
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t3
(
i3
INT
PRIMARY
KEY
)
ENGINE
=
InnoDB
;
INSERT
INTO
t3
VALUES
(
3
);
SELECT
*
FROM
t1
WHERE
NULL
IN
(
SELECT
i2
FROM
t2
WHERE
i1
IN
(
i2
IN
(
SELECT
i3
FROM
t3
)
)
AND
i2
=
2
);
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding
--
echo
#
...
...
sql/sql_select.cc
View file @
49552cf1
...
...
@@ -8443,8 +8443,6 @@ get_best_combination(JOIN *join)
join
->
full_join
=
0
;
join
->
hash_join
=
FALSE
;
used_tables
=
OUTER_REF_TABLE_BIT
;
// Outer row is already read
fix_semijoin_strategies_for_picked_join_order
(
join
);
JOIN_TAB_RANGE
*
root_range
;
...
...
@@ -8508,7 +8506,6 @@ get_best_combination(JOIN *join)
j
->
bush_root_tab
=
sjm_nest_root
;
form
=
join
->
table
[
tablenr
]
=
j
->
table
;
used_tables
|=
form
->
map
;
form
->
reginfo
.
join_tab
=
j
;
DBUG_PRINT
(
"info"
,(
"type: %d"
,
j
->
type
));
if
(
j
->
type
==
JT_CONST
)
...
...
@@ -8535,9 +8532,6 @@ get_best_combination(JOIN *join)
join->best_positions[tablenr].loosescan_picker.loosescan_key);
j->index= join->best_positions[tablenr].loosescan_picker.loosescan_key;
}*/
if
(
keyuse
&&
create_ref_for_key
(
join
,
j
,
keyuse
,
TRUE
,
used_tables
))
DBUG_RETURN
(
TRUE
);
// Something went wrong
if
((
j
->
type
==
JT_REF
||
j
->
type
==
JT_EQ_REF
)
&&
is_hash_join_key_no
(
j
->
ref
.
key
))
...
...
@@ -8563,6 +8557,21 @@ get_best_combination(JOIN *join)
}
root_range
->
end
=
j
;
used_tables
=
OUTER_REF_TABLE_BIT
;
// Outer row is already read
for
(
j
=
join_tab
,
tablenr
=
0
;
tablenr
<
table_count
;
tablenr
++
,
j
++
)
{
if
(
j
->
bush_children
)
j
=
j
->
bush_children
->
start
;
used_tables
|=
j
->
table
->
map
;
if
((
keyuse
=
join
->
best_positions
[
tablenr
].
key
)
&&
create_ref_for_key
(
join
,
j
,
keyuse
,
TRUE
,
used_tables
))
DBUG_RETURN
(
TRUE
);
// Something went wrong
if
(
j
->
last_leaf_in_bush
)
j
=
j
->
bush_root_tab
;
}
join
->
top_join_tab_count
=
join
->
join_tab_ranges
.
head
()
->
end
-
join
->
join_tab_ranges
.
head
()
->
start
;
/*
...
...
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