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
c9df1caa
Commit
c9df1caa
authored
Jan 22, 2007
by
gkodinov/kgeorge@rakia.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into rakia.gmz:/home/kgeorge/mysql/autopush/B16590-5.1-opt
parents
a5a43da1
9ea140d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
0 deletions
+38
-0
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+9
-0
mysql-test/t/order_by.test
mysql-test/t/order_by.test
+13
-0
sql/sql_select.cc
sql/sql_select.cc
+16
-0
No files found.
mysql-test/r/order_by.result
View file @
c9df1caa
...
...
@@ -926,3 +926,12 @@ NULL
2
3
DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE KEY b (b));
INSERT INTO t1 VALUES (1,1),(2,2);
CREATE TABLE t2 (a INT, b INT, KEY a (a,b));
INSERT INTO t2 VALUES (1,1),(1,2),(2,1),(2,2);
EXPLAIN SELECT 1 FROM t1,t2 WHERE t1.b=2 AND t1.a=t2.a ORDER BY t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY,b b 5 const 1
1 SIMPLE t2 ref a a 5 const 2 Using where; Using index
DROP TABLE t1,t2;
mysql-test/t/order_by.test
View file @
c9df1caa
...
...
@@ -640,3 +640,16 @@ SELECT t2.b FROM t1 LEFT JOIN (t2, t3 LEFT JOIN t4 ON t3.a=t4.a)
ON
(
t1
.
a
=
t2
.
a
AND
t1
.
b
=
t3
.
b
)
order
by
t2
.
b
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
#
# BUG#16590: Optimized does not do right "const" table pre-read
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
PRIMARY
KEY
(
a
),
UNIQUE
KEY
b
(
b
));
INSERT
INTO
t1
VALUES
(
1
,
1
),(
2
,
2
);
CREATE
TABLE
t2
(
a
INT
,
b
INT
,
KEY
a
(
a
,
b
));
INSERT
INTO
t2
VALUES
(
1
,
1
),(
1
,
2
),(
2
,
1
),(
2
,
2
);
EXPLAIN
SELECT
1
FROM
t1
,
t2
WHERE
t1
.
b
=
2
AND
t1
.
a
=
t2
.
a
ORDER
BY
t2
.
b
;
DROP
TABLE
t1
,
t2
;
sql/sql_select.cc
View file @
c9df1caa
...
...
@@ -7722,6 +7722,22 @@ static void update_const_equal_items(COND *cond, JOIN_TAB *tab)
key_map
possible_keys
=
field
->
key_start
;
possible_keys
.
intersect
(
field
->
table
->
keys_in_use_for_query
);
stat
[
0
].
const_keys
.
merge
(
possible_keys
);
/*
For each field in the multiple equality (for which we know that it
is a constant) we have to find its corresponding key part, and set
that key part in const_key_parts.
*/
if
(
!
possible_keys
.
is_clear_all
())
{
TABLE
*
tab
=
field
->
table
;
KEYUSE
*
use
;
for
(
use
=
stat
->
keyuse
;
use
&&
use
->
table
==
tab
;
use
++
)
if
(
possible_keys
.
is_set
(
use
->
key
)
&&
tab
->
key_info
[
use
->
key
].
key_part
[
use
->
keypart
].
field
==
field
)
tab
->
const_key_parts
[
use
->
key
]
|=
use
->
keypart_map
;
}
}
}
}
...
...
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