summaryrefslogtreecommitdiff
path: root/mysql-test/t/update.test
diff options
context:
space:
mode:
authorsergefp@mysql.com <>2005-09-30 15:21:37 +0400
committersergefp@mysql.com <>2005-09-30 15:21:37 +0400
commite9f2f9437a9c7be83db93d3461ce6e77245d1df4 (patch)
tree00b61167a0a17a8889f39b5ab9892775c48e78db /mysql-test/t/update.test
parentbd417d158ea1d4f262186ac73dbe3615d322c229 (diff)
downloadmariadb-git-e9f2f9437a9c7be83db93d3461ce6e77245d1df4.tar.gz
BUG#12915: Added single-table UPDATE/DELTE ... ORDER BY ... LIMIT
optimization: now can use index to find records to update/delete when there is no WHERE clause.
Diffstat (limited to 'mysql-test/t/update.test')
-rw-r--r--mysql-test/t/update.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index 84e9ced2017..a37655b15fe 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -227,4 +227,33 @@ select DATABASE();
delete from t1 where count(*)=1;
drop table t1;
+# BUG#12915: Optimize "DELETE|UPDATE ... ORDER BY ... LIMIT n" to use an index
+create table t1 ( a int, index (a) );
+insert into t1 values (0),(0),(0),(0),(0),(0),(0),(0);
+
+flush status;
+select a from t1 order by a limit 1;
+show status like 'handler_read%';
+
+flush status;
+update t1 set a=unix_timestamp() order by a limit 1;
+show status like 'handler_read%';
+
+flush status;
+delete from t1 order by a limit 1;
+show status like 'handler_read%';
+
+flush status;
+delete from t1 order by a desc limit 1;
+show status like 'handler_read%';
+
+alter table t1 disable keys;
+
+flush status;
+delete from t1 order by a limit 1;
+show status like 'handler_read%';
+
+select count(*) from t1;
+
+drop table t1;
# End of 4.1 tests