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
727896df
Commit
727896df
authored
Mar 17, 2014
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
4e1a928d
07a52afd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
1 deletion
+50
-1
mysql-test/r/update.result
mysql-test/r/update.result
+27
-0
mysql-test/t/update.test
mysql-test/t/update.test
+22
-0
sql/sql_update.cc
sql/sql_update.cc
+1
-1
No files found.
mysql-test/r/update.result
View file @
727896df
...
...
@@ -603,3 +603,30 @@ Variable_name Value
Handler_update 5
ROLLBACK;
DROP TABLE t1, t2;
#
# MDEV-4410: update does not want to use a covering index, but select uses it.
#
create table t2(a int);
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (key1 int, col1 int, key(key1));
insert into t1
select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;
# This must not have "Using filesort":
explain
update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range key1 key1 5 NULL 100 Using where; Using buffer
flush status;
update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
show status like 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_rnd 2
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
drop table t1, t2;
# End of MariaDB 10.0 tests
mysql-test/t/update.test
View file @
727896df
...
...
@@ -544,3 +544,25 @@ SHOW STATUS LIKE 'HANDLER_UPDATE';
ROLLBACK
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# MDEV-4410: update does not want to use a covering index, but select uses it.
--
echo
#
create
table
t2
(
a
int
);
insert
into
t2
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
create
table
t1
(
key1
int
,
col1
int
,
key
(
key1
));
insert
into
t1
select
A
.
a
+
10
*
B
.
a
+
100
*
C
.
a
,
1234
from
t2
A
,
t2
B
,
t2
C
;
--
echo
# This must not have "Using filesort":
explain
update
t1
set
key1
=
key1
+
1
where
key1
between
10
and
110
order
by
key1
limit
2
;
flush
status
;
update
t1
set
key1
=
key1
+
1
where
key1
between
10
and
110
order
by
key1
limit
2
;
# Handler_read_next should be 1 (due to LIMIT), not 100:
show
status
like
'Handler_read%'
;
drop
table
t1
,
t2
;
--
echo
# End of MariaDB 10.0 tests
sql/sql_update.cc
View file @
727896df
...
...
@@ -502,7 +502,7 @@ int mysql_update(THD *thd,
if
(
used_key_is_modified
||
order
||
partition_key_modified
(
table
,
table
->
write_set
))
{
if
(
order
&&
(
need_sort
||
used_key_is_modified
)
)
if
(
order
&&
need_sort
)
query_plan
.
using_filesort
=
true
;
else
query_plan
.
using_io_buffer
=
true
;
...
...
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