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
13e6d008
Commit
13e6d008
authored
Mar 26, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/work/mysql-4.0
parents
8a6ae839
9cc75495
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+8
-0
mysql-test/t/order_by.test
mysql-test/t/order_by.test
+12
-1
sql/sql_select.cc
sql/sql_select.cc
+12
-2
No files found.
mysql-test/r/order_by.result
View file @
13e6d008
...
...
@@ -546,3 +546,11 @@ CREATE TABLE t1 (a INT, b INT);
SET @id=0;
UPDATE t1 SET a=0 ORDER BY (a=@id), b;
DROP TABLE t1;
create table t1(id int not null auto_increment primary key, t char(12));
explain select id,t from t1 order by id;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 1000 Using filesort
explain select id,t from t1 force index (primary) order by id;
table type possible_keys key key_len ref rows Extra
t1 index NULL PRIMARY 4 NULL 1000
drop table t1;
mysql-test/t/order_by.test
View file @
13e6d008
...
...
@@ -352,4 +352,15 @@ CREATE TABLE t1 (a INT, b INT);
SET
@
id
=
0
;
UPDATE
t1
SET
a
=
0
ORDER
BY
(
a
=@
id
),
b
;
DROP
TABLE
t1
;
create
table
t1
(
id
int
not
null
auto_increment
primary
key
,
t
char
(
12
));
disable_query_log
;
let
$
1
=
1000
;
while
(
$
1
)
{
eval
insert
into
t1
(
t
)
values
(
'$1'
);
dec
$
1
;
}
enable_query_log
;
explain
select
id
,
t
from
t1
order
by
id
;
explain
select
id
,
t
from
t1
force
index
(
primary
)
order
by
id
;
drop
table
t1
;
\ No newline at end of file
sql/sql_select.cc
View file @
13e6d008
...
...
@@ -6021,7 +6021,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
/* check if we can use a key to resolve the group */
/* Tables using JT_NEXT are handled here */
uint
nr
;
key_map
keys
=
usable_keys
;
key_map
keys
_to_use
=~
0
,
keys
=
usable_keys
;
/*
If not used with LIMIT, only use keys if the whole query can be
...
...
@@ -6029,7 +6029,17 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
retrieving all rows through an index.
*/
if
(
select_limit
>=
table
->
file
->
records
)
keys
&=
(
table
->
used_keys
|
table
->
file
->
keys_to_use_for_scanning
());
keys_to_use
=
(
table
->
used_keys
|
table
->
file
->
keys_to_use_for_scanning
());
/*
We are adding here also the index speified in FORCE INDEX clause,
if any.
This is to allow users to use index in ORDER BY.
*/
if
(
table
->
force_index
)
keys_to_use
|=
table
->
keys_in_use_for_query
;
keys
&=
keys_to_use
;
for
(
nr
=
0
;
keys
;
keys
>>=
1
,
nr
++
)
{
...
...
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