summaryrefslogtreecommitdiff
path: root/mysql-test/t/explain_non_select.test
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2013-02-12 08:24:48 +0400
committerSergey Petrunya <psergey@askmonty.org>2013-02-12 08:24:48 +0400
commitb38b44cfe1c62b4c2211aec7c3f1407f14a2aa21 (patch)
treecd8cf9494434f40534a48e5dd8190bd9ba815559 /mysql-test/t/explain_non_select.test
parent18fec5128b6fd9712f63e306f03f16833f2599b2 (diff)
downloadmariadb-git-b38b44cfe1c62b4c2211aec7c3f1407f14a2aa21.tar.gz
EXPLAIN DELETE for MariaDB
- Include the testcases in the backport.
Diffstat (limited to 'mysql-test/t/explain_non_select.test')
-rw-r--r--mysql-test/t/explain_non_select.test47
1 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/t/explain_non_select.test b/mysql-test/t/explain_non_select.test
new file mode 100644
index 00000000000..bc3c2bb6c16
--- /dev/null
+++ b/mysql-test/t/explain_non_select.test
@@ -0,0 +1,47 @@
+#
+# MariaDB tests for EXPLAIN UPDATE/DELETE.
+#
+--disable_warnings
+drop table if exists t0;
+--enable_warnings
+
+create table t0 (a int) engine=myisam;
+insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8);
+
+--echo #
+--echo # Tests for single-table DELETE
+--echo #
+
+explain select * from t0 where a=3;
+explain delete from t0 where a=3;
+
+--echo # DELETE without WHERE is a special case:
+explain delete from t0;
+
+create table t1 (a int, b int, filler char(100), key(a), key(b));
+insert into t1
+select A.a+10*B.a + 10*C.a, A.a+10*B.a + 10*C.a, 'filler'
+from t0 A, t0 B, t0 C;
+
+--echo # This should use an index, possible_keys=NULL because there is no WHERE
+explain delete from t1 order by a limit 2;
+
+--echo # This should use range, possible_keys={a,b}
+explain delete from t1 where a<20 and b < 10;
+
+--echo # This should use ALL + filesort
+explain delete from t1 order by a+1 limit 2;
+
+--echo # This should use range + using filesort
+explain delete from t1 where a<20 order by b limit 2;
+
+--echo # Try some subqueries:
+explain delete from t1 where a < (select max(a) from t0);
+explain delete from t1 where a < (select max(a) from t0 where a < t1.b);
+
+--echo #
+--echo # Tests for multi-table DELETE
+--echo #
+explain delete t1 from t0, t1 where t0.a = t1.a;
+
+drop table t0, t1;