summaryrefslogtreecommitdiff
path: root/mysql-test/t/delete.test
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2007-01-11 16:05:03 +0300
committerevgen@moonbone.local <>2007-01-11 16:05:03 +0300
commitc17bf5cb239fa8bb3039aef13203e9d99242442a (patch)
tree3f812f133e5ed41c5a017ed76ed1ea19eda4166f /mysql-test/t/delete.test
parent53d97a7d721463fd8004c1472b3e10ac352daec1 (diff)
downloadmariadb-git-c17bf5cb239fa8bb3039aef13203e9d99242442a.tar.gz
Bug#17711: DELETE doesn't use index when ORDER BY, LIMIT and non-restricting
WHERE is present. If a DELETE statement with ORDER BY and LIMIT contains a WHERE clause with conditions that for sure cannot be used for index access (like in WHERE @var:= field) the execution always follows the filesort path. It happens currently even when for the above case there is an index that can be used to speedup sorting by the order by list. Now if a DELETE statement with ORDER BY and LIMIT contains such WHERE clause conditions that cannot be used to build any quick select then the mysql_delete() tries to use an index like there is no WHERE clause at all.
Diffstat (limited to 'mysql-test/t/delete.test')
-rw-r--r--mysql-test/t/delete.test10
1 files changed, 10 insertions, 0 deletions
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 2036b59d810..301b2cdbb99 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -174,4 +174,14 @@ delete from t1 where a is null;
select count(*) from t1;
drop table t1;
+#
+# Bug#17711: DELETE doesn't use index when ORDER BY, LIMIT and
+# non-restricting WHERE is present.
+#
+create table t1(f1 int primary key);
+insert into t1 values (4),(3),(1),(2);
+delete from t1 where (@a:= f1) order by f1 limit 1;
+select @a;
+drop table t1;
+
--echo End of 4.1 tests