summaryrefslogtreecommitdiff
path: root/mysql-test/t/analyze_stmt.test
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2014-05-27 20:16:51 +0400
committerSergei Petrunia <psergey@askmonty.org>2014-05-27 20:16:51 +0400
commit0925ab9d88f4328810d25392333a4cac11c6e694 (patch)
tree2b340479746f5e31afc9da3a2f8a5efe7edcddcd /mysql-test/t/analyze_stmt.test
parenteaba1ba4a575c5280d41eaa3deac890dd25d82e4 (diff)
downloadmariadb-git-0925ab9d88f4328810d25392333a4cac11c6e694.tar.gz
MDEV-406: ANALYZE $stmt
-Add analyze_stmt.test/result
Diffstat (limited to 'mysql-test/t/analyze_stmt.test')
-rw-r--r--mysql-test/t/analyze_stmt.test31
1 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/t/analyze_stmt.test b/mysql-test/t/analyze_stmt.test
new file mode 100644
index 00000000000..61ebc567057
--- /dev/null
+++ b/mysql-test/t/analyze_stmt.test
@@ -0,0 +1,31 @@
+#
+# Tests for "ANALYZE $statement" feature (PostgreSQL's analog is called EXPLAIN ANALYZE)
+#
+--disable_warnings
+drop table if exists t0,t1,t2,t3;
+--enable_warnings
+
+create table t0 (a int) engine=myisam;
+INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1 (a int) engine=myisam;
+INSERT INTO t1 select * from t0;
+
+--echo # Try a few basic selects to see that r_rows and r_filtered columns work
+analyze select * from t1;
+analyze select * from t1 where a<5;
+analyze select * from t1 where a>100;
+
+--echo # ANALYZE DELETE will delete rows:
+analyze delete from t1 where a in (2,3,4);
+select * from t1;
+drop table t1;
+
+--echo # ANALYZE UPDATE will make updates:
+create table t1(a int, b int);
+insert into t1 select a,a from t0;
+analyze update t1 set b=100+b where a in (6,7,8);
+select * from t1;
+drop table t1;
+
+drop table t0;