| 1 |
create table t1(a int) engine=ndbcluster; |
| 2 |
create table t2(a int) engine=ndbcluster; |
| 3 |
insert into t1 values(10),(11),(12),(13),(14),(15),(16); |
| 4 |
insert into t2 values(100),(11),(120); |
| 5 |
analyze table t1,t2; |
| 6 |
Table Op Msg_type Msg_text |
| 7 |
test.t1 analyze status OK |
| 8 |
test.t2 analyze status OK |
| 9 |
explain format=tree update t1 set t1.a=3 where a=(select a from t2); |
| 10 |
EXPLAIN |
| 11 |
<not executable by iterator executor> |
| 12 |
|
| 13 |
explain update t1 set t1.a=3 where a in (select a from t2); |
| 14 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 15 |
1 UPDATE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 7 100.00 Using where |
| 16 |
2 DEPENDENT SUBQUERY t2 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3 33.33 Using pushed condition (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) |
| 17 |
Warnings: |
| 18 |
Note 1003 update `test`.`t1` set `test`.`t1`.`a` = 3 where <in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` where (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`))) |
| 19 |
update t1 set t1.a=3 where a in (select a from t2); |
| 20 |
select * from t1; |
| 21 |
a |
| 22 |
10 |
| 23 |
12 |
| 24 |
13 |
| 25 |
14 |
| 26 |
15 |
| 27 |
16 |
| 28 |
3 |
| 29 |
delete from t1; |
| 30 |
insert into t1 values(10),(11),(12),(13),(14),(15),(16); |
| 31 |
analyze table t1; |
| 32 |
Table Op Msg_type Msg_text |
| 33 |
test.t1 analyze status OK |
| 34 |
explain format=tree delete from t1 where a=(select a from t2); |
| 35 |
EXPLAIN |
| 36 |
<not executable by iterator executor> |
| 37 |
|
| 38 |
explain delete from t1 where a in (select a from t2); |
| 39 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 40 |
1 DELETE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 7 100.00 Using where |
| 41 |
2 DEPENDENT SUBQUERY t2 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3 33.33 Using pushed condition (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) |
| 42 |
Warnings: |
| 43 |
Note 1003 delete from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` where (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`))) |
| 44 |
delete from t1 where a in (select a from t2); |
| 45 |
select * from t1; |
| 46 |
a |
| 47 |
10 |
| 48 |
12 |
| 49 |
13 |
| 50 |
14 |
| 51 |
15 |
| 52 |
16 |
| 53 |
drop table t1,t2; |