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
cead246f
Commit
cead246f
authored
May 04, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge magare.gmz:/home/kgeorge/mysql/work/B27531-4.1-opt
into magare.gmz:/home/kgeorge/mysql/work/B27531-5.0-opt
parents
287ebed1
d11e1f24
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
3 deletions
+80
-3
mysql-test/r/join.result
mysql-test/r/join.result
+50
-0
mysql-test/t/join.test
mysql-test/t/join.test
+24
-0
sql/sql_select.cc
sql/sql_select.cc
+6
-3
No files found.
mysql-test/r/join.result
View file @
cead246f
...
...
@@ -391,6 +391,56 @@ i i i
2 NULL 4
2 2 2
drop table t1,t2,t3;
CREATE TABLE t1 (a int, b int default 0, c int default 1);
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
INSERT INTO t1 (a) SELECT a + 8 FROM t1;
INSERT INTO t1 (a) SELECT a + 16 FROM t1;
CREATE TABLE t2 (a int, d int, e int default 0);
INSERT INTO t2 (a, d) VALUES (1,1),(2,2),(3,3),(4,4);
INSERT INTO t2 (a, d) SELECT a+4, a+4 FROM t2;
INSERT INTO t2 (a, d) SELECT a+8, a+8 FROM t2;
EXPLAIN
SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
ORDER BY t1.b, t1.c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 32 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 16 Using where
SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
ORDER BY t1.b, t1.c;
e
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
DROP TABLE t1,t2;
create table t1 (c int, b int);
create table t2 (a int, b int);
create table t3 (b int, c int);
...
...
mysql-test/t/join.test
View file @
cead246f
...
...
@@ -333,6 +333,30 @@ select t1.i,t2.i,t3.i from t2 natural right join t3,t1 order by t1.i,t2.i,t3.i;
select
t1
.
i
,
t2
.
i
,
t3
.
i
from
t2
right
join
t3
on
(
t2
.
i
=
t3
.
i
),
t1
order
by
t1
.
i
,
t2
.
i
,
t3
.
i
;
drop
table
t1
,
t2
,
t3
;
#
# Bug #27531: Query performance degredation in 4.1.22 and greater
#
CREATE
TABLE
t1
(
a
int
,
b
int
default
0
,
c
int
default
1
);
INSERT
INTO
t1
(
a
)
VALUES
(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
);
INSERT
INTO
t1
(
a
)
SELECT
a
+
8
FROM
t1
;
INSERT
INTO
t1
(
a
)
SELECT
a
+
16
FROM
t1
;
CREATE
TABLE
t2
(
a
int
,
d
int
,
e
int
default
0
);
INSERT
INTO
t2
(
a
,
d
)
VALUES
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
);
INSERT
INTO
t2
(
a
,
d
)
SELECT
a
+
4
,
a
+
4
FROM
t2
;
INSERT
INTO
t2
(
a
,
d
)
SELECT
a
+
8
,
a
+
8
FROM
t2
;
# should use join cache
EXPLAIN
SELECT
STRAIGHT_JOIN
t2
.
e
FROM
t1
,
t2
WHERE
t2
.
d
=
1
AND
t1
.
b
=
t2
.
e
ORDER
BY
t1
.
b
,
t1
.
c
;
SELECT
STRAIGHT_JOIN
t2
.
e
FROM
t1
,
t2
WHERE
t2
.
d
=
1
AND
t1
.
b
=
t2
.
e
ORDER
BY
t1
.
b
,
t1
.
c
;
DROP
TABLE
t1
,
t2
;
# End of 4.1 tests
#
...
...
sql/sql_select.cc
View file @
cead246f
...
...
@@ -6000,11 +6000,14 @@ make_join_readinfo(JOIN *join, ulonglong options)
disable join cache because it will change the ordering of the results.
Code handles sort table that is at any location (not only first after
the const tables) despite the fact that it's currently prohibited.
We must disable join cache if the first non-const table alone is
ordered. If there is a temp table the ordering is done as a last
operation and doesn't prevent join cache usage.
*/
if
(
!
ordered_set
&&
(
table
==
join
->
sort_by_table
&&
if
(
!
ordered_set
&&
!
join
->
need_tmp
&&
(
(
table
==
join
->
sort_by_table
&&
(
!
join
->
order
||
join
->
skip_sort_order
))
||
(
join
->
sort_by_table
==
(
TABLE
*
)
1
&&
i
!=
join
->
const_tables
))
(
join
->
sort_by_table
==
(
TABLE
*
)
1
&&
i
!=
join
->
const_tables
))
)
ordered_set
=
1
;
switch
(
tab
->
type
)
{
...
...
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