File: ndb_subquery.result

package info (click to toggle)
mysql-dfsg-4.1 4.1.11a-4sarge8
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 86,724 kB
  • ctags: 78,396
  • sloc: ansic: 380,120; cpp: 348,266; sh: 32,501; tcl: 30,484; perl: 20,873; yacc: 5,447; java: 4,610; makefile: 4,406; xml: 3,857; pascal: 1,795; awk: 1,338; asm: 1,064; sed: 772; sql: 503
file content (42 lines) | stat: -rw-r--r-- 1,718 bytes parent folder | download
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
drop table if exists t1;
drop table if exists t2;
create table t1 (p int not null primary key, u int not null, o int not null,
unique (u), key(o)) engine=ndb;
create table t2 (p int not null primary key, u int not null, o int not null,
unique (u), key(o)) engine=ndb;
insert into t1 values (1,1,1),(2,2,2),(3,3,3);
insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5);
explain select * from t2 where p NOT IN (select p from t1);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	5	Using where
2	DEPENDENT SUBQUERY	t1	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
select * from t2 where p NOT IN (select p from t1) order by p;
p	u	o
4	4	4
5	5	5
explain select * from t2 where p NOT IN (select u from t1);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	5	Using where
2	DEPENDENT SUBQUERY	t1	unique_subquery	u	u	4	func	1	Using index
select * from t2 where p NOT IN (select u from t1) order by p;
p	u	o
4	4	4
5	5	5
explain select * from t2 where p NOT IN (select o from t1);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	5	Using where
2	DEPENDENT SUBQUERY	t1	index_subquery	o	o	4	func	1	Using index
select * from t2 where p NOT IN (select o from t1) order by p;
p	u	o
4	4	4
5	5	5
explain select * from t2 where p NOT IN (select p+0 from t1);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	5	Using where
2	DEPENDENT SUBQUERY	t1	ALL	NULL	NULL	NULL	NULL	3	Using where
select * from t2 where p NOT IN (select p+0 from t1) order by p;
p	u	o
4	4	4
5	5	5
drop table t1;
drop table t2;