# # SHOW EXPLAIN tests for non-select subqueries # --source include/have_debug.inc --source include/have_innodb.inc --source include/not_embedded.inc --disable_warnings drop table if exists t0, t1; --enable_warnings SET @old_debug= @@session.debug; set debug_sync='RESET'; # # Setup two threads and their ids # let $thr1=`select connection_id()`; connect (con2, localhost, root,,); connection con2; let $thr2=`select connection_id()`; connection default; # # Create tables # create table t0 (a int) engine=myisam; insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8); 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; let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2; --echo # --echo # Test SHOW EXPLAIN for single-table DELETE --echo # connection con2; SET debug_dbug='+d,show_explain_probe_delete_exec_start'; send delete from t1 where a<10 and b+1>1000; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con2; reap; --echo # --echo # Test SHOW EXPLAIN for multi-table DELETE --echo # set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_do_select'; send delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con2; reap; --echo # --echo # Test SHOW EXPLAIN for single-table UPDATE --echo # connection con2; SET debug_dbug='+d,show_explain_probe_update_exec_start'; send update t1 set filler='filler-data-2' where a<10 and b+1>1000; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con2; reap; drop table t0,t1; SET debug_dbug=@old_debug; set debug_sync='RESET';