From 98a8642fe827fd9ac16bdfaf556599fa509d4180 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Mon, 7 Oct 2013 17:29:51 +0400 Subject: MDEV-3798: EXPLAIN UPDATE/DELETE - Add support for EXPLAIN INSERT. --- mysql-test/r/explain_non_select.result | 17 +++++++++++++++++ mysql-test/t/explain_non_select.test | 15 +++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/explain_non_select.result b/mysql-test/r/explain_non_select.result index 3cc4d4f1e26..1c5d545fd99 100644 --- a/mysql-test/r/explain_non_select.result +++ b/mysql-test/r/explain_non_select.result @@ -181,3 +181,20 @@ explain partitions update t1 set b=12345 where a in (32,33); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No matching rows after partition pruning drop table t1; +# +# Tests for EXPLAIN INSERT ... VALUES +# +create table t1 (a int, key(a)); +explain insert into t1 values (1),(2),(3); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +insert into t1 values (1),(2),(3); +create table t2 (a int, b int); +explain insert into t2 values +(10, 1+(select max(a) from t1)), +(11, 1+(select max(a+1) from t1)); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t2 ALL NULL NULL NULL NULL NULL NULL +3 SUBQUERY t1 index NULL a 5 NULL 3 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +drop table t1,t2; diff --git a/mysql-test/t/explain_non_select.test b/mysql-test/t/explain_non_select.test index 3c4c2d0739d..7220a00bd2a 100644 --- a/mysql-test/t/explain_non_select.test +++ b/mysql-test/t/explain_non_select.test @@ -155,3 +155,18 @@ explain partitions delete from t1 where a in (32,33); explain partitions update t1 set b=12345 where a in (32,33); drop table t1; + +--echo # +--echo # Tests for EXPLAIN INSERT ... VALUES +--echo # +create table t1 (a int, key(a)); +explain insert into t1 values (1),(2),(3); +insert into t1 values (1),(2),(3); + +create table t2 (a int, b int); +explain insert into t2 values + (10, 1+(select max(a) from t1)), + (11, 1+(select max(a+1) from t1)); + +drop table t1,t2; + -- cgit v1.2.1