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
a64f67bc
Commit
a64f67bc
authored
Jul 14, 2006
by
gkodinov/kgeorge@macbook.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge macbook.gmz:/Users/kgeorge/mysql/work/B17212-4.1-opt
into macbook.gmz:/Users/kgeorge/mysql/work/B17212-5.0-opt
parents
52bee69e
5079d5cf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
1 deletion
+80
-1
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+29
-0
mysql-test/t/innodb_mysql.test
mysql-test/t/innodb_mysql.test
+32
-0
sql/sql_select.cc
sql/sql_select.cc
+19
-1
No files found.
mysql-test/r/innodb_mysql.result
View file @
a64f67bc
...
...
@@ -54,6 +54,35 @@ c.c_id = 218 and expiredate is null;
slai_id
12
drop table t1, t2;
CREATE TABLE t1 (a int, b int, KEY b (b)) Engine=InnoDB;
CREATE TABLE t2 (a int, b int, PRIMARY KEY (a,b)) Engine=InnoDB;
CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a),
UNIQUE KEY b (b,c), KEY a (a,b,c)) Engine=InnoDB;
INSERT INTO t1 VALUES (1, 1);
INSERT INTO t1 SELECT a + 1, b + 1 FROM t1;
INSERT INTO t1 SELECT a + 2, b + 2 FROM t1;
INSERT INTO t2 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
INSERT INTO t2 SELECT a + 1, b FROM t2;
DELETE FROM t2 WHERE a = 1 AND b < 2;
INSERT INTO t3 VALUES (1,1,1),(2,1,2);
INSERT INTO t3 SELECT a + 2, a + 2, 3 FROM t3;
INSERT INTO t3 SELECT a + 4, a + 4, 3 FROM t3;
SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
ORDER BY t1.b LIMIT 2;
b a
1 1
2 2
SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
ORDER BY t1.b LIMIT 5;
b a
1 1
2 2
2 2
3 3
3 3
DROP TABLE t1, t2, t3;
create table t1m (a int) engine=myisam;
create table t1i (a int) engine=innodb;
create table t2m (a int) engine=myisam;
...
...
mysql-test/t/innodb_mysql.test
View file @
a64f67bc
...
...
@@ -58,6 +58,38 @@ where
drop
table
t1
,
t2
;
#
# Bug#17212: results not sorted correctly by ORDER BY when using index
# (repeatable only w/innodb because of index props)
#
CREATE
TABLE
t1
(
a
int
,
b
int
,
KEY
b
(
b
))
Engine
=
InnoDB
;
CREATE
TABLE
t2
(
a
int
,
b
int
,
PRIMARY
KEY
(
a
,
b
))
Engine
=
InnoDB
;
CREATE
TABLE
t3
(
a
int
,
b
int
,
c
int
,
PRIMARY
KEY
(
a
),
UNIQUE
KEY
b
(
b
,
c
),
KEY
a
(
a
,
b
,
c
))
Engine
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
1
,
1
);
INSERT
INTO
t1
SELECT
a
+
1
,
b
+
1
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
2
,
b
+
2
FROM
t1
;
INSERT
INTO
t2
VALUES
(
1
,
1
),(
1
,
2
),(
1
,
3
),(
1
,
4
),(
1
,
5
),(
1
,
6
),(
1
,
7
),(
1
,
8
);
INSERT
INTO
t2
SELECT
a
+
1
,
b
FROM
t2
;
DELETE
FROM
t2
WHERE
a
=
1
AND
b
<
2
;
INSERT
INTO
t3
VALUES
(
1
,
1
,
1
),(
2
,
1
,
2
);
INSERT
INTO
t3
SELECT
a
+
2
,
a
+
2
,
3
FROM
t3
;
INSERT
INTO
t3
SELECT
a
+
4
,
a
+
4
,
3
FROM
t3
;
# demonstrate a problem when a must-use-sort table flag
# (sort_by_table=1) is being neglected.
SELECT
STRAIGHT_JOIN
SQL_NO_CACHE
t1
.
b
,
t1
.
a
FROM
t1
,
t3
,
t2
WHERE
t3
.
a
=
t2
.
a
AND
t2
.
b
=
t1
.
a
AND
t3
.
b
=
1
AND
t3
.
c
IN
(
1
,
2
)
ORDER
BY
t1
.
b
LIMIT
2
;
# demonstrate the problem described in the bug report
SELECT
STRAIGHT_JOIN
SQL_NO_CACHE
t1
.
b
,
t1
.
a
FROM
t1
,
t3
,
t2
WHERE
t3
.
a
=
t2
.
a
AND
t2
.
b
=
t1
.
a
AND
t3
.
b
=
1
AND
t3
.
c
IN
(
1
,
2
)
ORDER
BY
t1
.
b
LIMIT
5
;
DROP
TABLE
t1
,
t2
,
t3
;
#
# Bug #12882 min/max inconsistent on empty table
#
...
...
sql/sql_select.cc
View file @
a64f67bc
...
...
@@ -5482,6 +5482,7 @@ make_join_readinfo(JOIN *join, uint options)
uint
i
;
bool
statistics
=
test
(
!
(
join
->
select_options
&
SELECT_DESCRIBE
));
bool
ordered_set
=
0
;
DBUG_ENTER
(
"make_join_readinfo"
);
for
(
i
=
join
->
const_tables
;
i
<
join
->
tables
;
i
++
)
...
...
@@ -5491,6 +5492,22 @@ make_join_readinfo(JOIN *join, uint options)
tab
->
read_record
.
table
=
table
;
tab
->
read_record
.
file
=
table
->
file
;
tab
->
next_select
=
sub_select
;
/* normal select */
/*
Determine if the set is already ordered for ORDER BY, so it can
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.
*/
if
(
!
ordered_set
&&
(
table
==
join
->
sort_by_table
&&
(
!
join
->
order
||
join
->
skip_sort_order
||
test_if_skip_sort_order
(
tab
,
join
->
order
,
join
->
select_limit
,
1
))
)
||
(
join
->
sort_by_table
==
(
TABLE
*
)
1
&&
i
!=
join
->
const_tables
))
ordered_set
=
1
;
switch
(
tab
->
type
)
{
case
JT_SYSTEM
:
// Only happens with left join
table
->
status
=
STATUS_NO_RECORD
;
...
...
@@ -5561,10 +5578,11 @@ make_join_readinfo(JOIN *join, uint options)
case
JT_ALL
:
/*
If previous table use cache
If the incoming data set is already sorted don't use cache.
*/
table
->
status
=
STATUS_NO_RECORD
;
if
(
i
!=
join
->
const_tables
&&
!
(
options
&
SELECT_NO_JOIN_CACHE
)
&&
tab
->
use_quick
!=
2
&&
!
tab
->
first_inner
)
tab
->
use_quick
!=
2
&&
!
tab
->
first_inner
&&
!
ordered_set
)
{
if
((
options
&
SELECT_DESCRIBE
)
||
!
join_init_cache
(
join
->
thd
,
join
->
join_tab
+
join
->
const_tables
,
...
...
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