summaryrefslogtreecommitdiff
path: root/mysql-test/r/show_explain_non_select.result
blob: 6076a848e22855f1ab38d9c8415768a4e7ae8fae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
drop table if exists t0, t1;
SET @old_debug= @@session.debug;
set debug_sync='RESET';
connect  con2, localhost, root,,;
connection con2;
connection default;
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;
#
# Test SHOW EXPLAIN for single-table DELETE
#
connection con2;
set debug_dbug='+d,show_explain_probe_delete_exec_start';
delete from t1 where a<10 and b+1>1000;
connection default;
show explain for $thr2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	a	a	5	NULL	1	Using where
Warnings:
Note	1003	delete from t1 where a<10 and b+1>1000
connection con2;
#
# Test SHOW EXPLAIN for multi-table DELETE
#
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000;
connection default;
show explain for $thr2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t0	ALL	NULL	NULL	NULL	NULL	8	Using where
1	SIMPLE	t1	ref	a	a	5	test.t0.a	4	Using where
Warnings:
Note	1003	delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000
connection con2;
#
# Test SHOW EXPLAIN for single-table UPDATE
#
connection con2;
set debug_dbug='+d,show_explain_probe_update_exec_start';
update t1 set filler='filler-data-2' where a<10 and b+1>1000;
connection default;
show explain for $thr2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	a	a	5	NULL	1	Using where
Warnings:
Note	1003	update t1 set filler='filler-data-2' where a<10 and b+1>1000
connection con2;
drop table t0,t1;
set debug_dbug=@old_debug;
set debug_sync='RESET';