~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/subselect_sj2.result

  • Committer: Brian Aker
  • Date: 2009-07-29 07:29:19 UTC
  • mfrom: (1103.1.4 merge)
  • Revision ID: brian@gaz-20090729072919-1pv9yqddtpoljgia
Merge of SJ code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
9       5
32
32
explain select * from t2 where b in (select a from t1);
33
33
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
34
 
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       Start temporary
35
 
1       PRIMARY t2      ref     b       b       5       test.t1.a       1       End temporary
 
34
1       PRIMARY t2      ALL     NULL    NULL    NULL    NULL    10      Using where
 
35
2       SUBQUERY        t1      ALL     NULL    NULL    NULL    NULL    3       
36
36
select * from t2 where b in (select a from t1);
37
37
a       b
38
38
1       1
49
49
insert into t3 select a,a, a,a,a from t0;
50
50
explain select * from t3 where b in (select a from t1);
51
51
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
52
 
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       Start temporary
53
 
1       PRIMARY t3      ref     b       b       5       test.t1.a       1       End temporary
 
52
1       PRIMARY t3      ALL     NULL    NULL    NULL    NULL    10      Using where
 
53
2       SUBQUERY        t1      ALL     NULL    NULL    NULL    NULL    3       
54
54
select * from t3 where b in (select a from t1);
55
55
a       b       pk1     pk2     pk3
56
56
1       1       1       1       1
71
71
from t0 A, t0 B where B.a <5;
72
72
explain select * from t3 where b in (select a from t0);
73
73
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
74
 
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    10      Start temporary
75
 
1       PRIMARY t3      ref     b       b       5       test.t0.a       1       End temporary
 
74
1       PRIMARY t3      ALL     NULL    NULL    NULL    NULL    50      Using where
 
75
2       SUBQUERY        t0      ALL     NULL    NULL    NULL    NULL    10      
76
76
select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
77
77
a       b       pk1     pk2
78
78
0       0       0       0
79
79
1       1       1       1
 
80
10      10      10      10
 
81
11      11      11      11
 
82
12      12      12      12
 
83
13      13      13      13
80
84
2       2       2       2
81
85
3       3       3       3
82
86
4       4       4       4
85
89
7       7       7       7
86
90
8       8       8       8
87
91
9       9       9       9
88
 
10      10      10      10
89
 
11      11      11      11
90
 
12      12      12      12
91
 
13      13      13      13
92
92
set join_buffer_size= @save_join_buffer_size;
93
93
set max_heap_table_size= @save_max_heap_table_size;
94
94
explain select * from t1 where a in (select b from t2);
95
95
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
96
 
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       
97
 
1       PRIMARY t2      ref     b       b       5       test.t1.a       1       Using index; FirstMatch(t1)
 
96
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       Using where
 
97
2       SUBQUERY        t2      index   NULL    b       5       NULL    10      Using index
98
98
select * from t1;
99
99
a       b
100
100
1       1
123
123
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z 
124
124
from t1 t0 where a in (select a from t2 it);
125
125
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
126
 
1       PRIMARY it      ALL     NULL    NULL    NULL    NULL    22      Start temporary
127
 
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    32      Using where; End temporary; Using join buffer
 
126
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    32      Using where
 
127
2       SUBQUERY        it      ALL     NULL    NULL    NULL    NULL    22      
128
128
select 
129
129
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z 
130
130
from t1 t0 where a in (select a from t2 it);
155
155
a, mid(filler1, 1,10), length(filler1)=length(filler2) 
156
156
from t2 t0 where a in (select a from t1 it);
157
157
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
158
 
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    22      Start temporary
159
 
1       PRIMARY it      ALL     NULL    NULL    NULL    NULL    32      Using where; End temporary; Using join buffer
 
158
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    22      Using where
 
159
2       SUBQUERY        it      ALL     NULL    NULL    NULL    NULL    32      
160
160
select 
161
161
a, mid(filler1, 1,10), length(filler1)=length(filler2) 
162
162
from t2 t0 where a in (select a from t1 it);
165
165
1       filler1234      1
166
166
2       filler1234      1
167
167
3       filler1234      1
 
168
4       filler1234      1
 
169
5       filler1234      1
 
170
6       filler1234      1
 
171
7       filler1234      1
 
172
8       filler1234      1
 
173
9       filler1234      1
 
174
10      filler1234      1
 
175
11      filler1234      1
 
176
12      filler1234      1
 
177
13      filler1234      1
 
178
14      filler1234      1
 
179
15      filler1234      1
 
180
16      filler1234      1
 
181
17      filler1234      1
 
182
18      filler1234      1
 
183
19      filler1234      1
168
184
3       duplicate       1
169
 
4       filler1234      1
170
 
5       filler1234      1
171
 
6       filler1234      1
172
 
7       filler1234      1
173
 
8       filler1234      1
174
 
9       filler1234      1
175
 
10      filler1234      1
176
 
11      filler1234      1
177
 
12      filler1234      1
178
 
13      filler1234      1
179
 
14      filler1234      1
180
 
15      filler1234      1
181
 
16      filler1234      1
182
 
17      filler1234      1
183
 
18      filler1234      1
184
 
19      filler1234      1
185
185
19      duplicate       1
186
186
insert into t1 select a+20, 'filler123456', 'filler123456' from t0;
187
187
insert into t1 select a+20, 'filler123456', 'filler123456' from t0;
189
189
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z 
190
190
from t1 t0 where a in (select a from t2 it);
191
191
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
192
 
1       PRIMARY it      ALL     NULL    NULL    NULL    NULL    22      Start temporary
193
 
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    52      Using where; End temporary; Using join buffer
 
192
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    52      Using where
 
193
2       SUBQUERY        it      ALL     NULL    NULL    NULL    NULL    22      
194
194
select 
195
195
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z 
196
196
from t1 t0 where a in (select a from t2 it);
221
221
a, mid(filler1, 1,10), length(filler1)=length(filler2) 
222
222
from t2 t0 where a in (select a from t1 it);
223
223
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
224
 
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    22      Start temporary
225
 
1       PRIMARY it      ALL     NULL    NULL    NULL    NULL    52      Using where; End temporary; Using join buffer
 
224
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    22      Using where
 
225
2       SUBQUERY        it      ALL     NULL    NULL    NULL    NULL    52      
226
226
select 
227
227
a, mid(filler1, 1,10), length(filler1)=length(filler2) 
228
228
from t2 t0 where a in (select a from t1 it);
231
231
1       filler1234      1
232
232
2       filler1234      1
233
233
3       filler1234      1
 
234
4       filler1234      1
 
235
5       filler1234      1
 
236
6       filler1234      1
 
237
7       filler1234      1
 
238
8       filler1234      1
 
239
9       filler1234      1
 
240
10      filler1234      1
 
241
11      filler1234      1
 
242
12      filler1234      1
 
243
13      filler1234      1
 
244
14      filler1234      1
 
245
15      filler1234      1
 
246
16      filler1234      1
 
247
17      filler1234      1
 
248
18      filler1234      1
 
249
19      filler1234      1
234
250
3       duplicate       1
235
 
4       filler1234      1
236
 
5       filler1234      1
237
 
6       filler1234      1
238
 
7       filler1234      1
239
 
8       filler1234      1
240
 
9       filler1234      1
241
 
10      filler1234      1
242
 
11      filler1234      1
243
 
12      filler1234      1
244
 
13      filler1234      1
245
 
14      filler1234      1
246
 
15      filler1234      1
247
 
16      filler1234      1
248
 
17      filler1234      1
249
 
18      filler1234      1
250
 
19      filler1234      1
251
251
19      duplicate       1
252
252
drop table t1, t2;
253
253
create table t1 (a int, b int, key(a));
261
261
from t0 where a in
262
262
(select t2.a+t3.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a);
263
263
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
264
 
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    10      Start temporary
265
 
1       PRIMARY t1      index   NULL    a       5       NULL    10      Using index; Using join buffer
266
 
1       PRIMARY t2      ref     a       a       5       test.t1.a       1       Using index
267
 
1       PRIMARY t3      ref     a       a       5       test.t1.a       1       Using where; Using index; End temporary
 
264
1       PRIMARY t0      ALL     NULL    NULL    NULL    NULL    10      Using where
 
265
2       SUBQUERY        t1      index   NULL    a       5       NULL    10      Using index
 
266
2       SUBQUERY        t2      ref     a       a       5       test.t1.a       1       Using index
 
267
2       SUBQUERY        t3      ref     a       a       5       test.t1.a       1       Using index
268
268
drop table t0, t1,t2,t3;
269
269
CREATE TABLE t1 (
270
270
ID int NOT NULL auto_increment,
300
300
WHERE Language='English' AND Percentage > 10 AND
301
301
t2.Population > 100000);
302
302
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
303
 
1       PRIMARY t2      ALL     PRIMARY,Population      NULL    NULL    NULL    16      Using where
304
 
1       PRIMARY t3      eq_ref  PRIMARY,Percentage      PRIMARY 136     test.t2.Code,const      1       Using where
305
 
1       PRIMARY t1      ref     Population,Country      Country 14      test.t2.Code    1       Using where; FirstMatch(t3)
 
303
1       PRIMARY t2      ALL     NULL    NULL    NULL    NULL    16      Using where
 
304
3       DEPENDENT SUBQUERY      t3      unique_subquery PRIMARY,Percentage      PRIMARY 136     func,const      1       Using where
 
305
2       SUBQUERY        t1      range   Population      Population      4       NULL    1       Using where
306
306
DROP TABLE t1,t2,t3;
307
307
CREATE TABLE t1 (
308
308
Code char(3) NOT NULL DEFAULT '',
336
336
WHERE t1.Code IN (
337
337
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
338
338
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
339
 
1       PRIMARY t1      ALL     PRIMARY NULL    NULL    NULL    31      
340
 
1       PRIMARY t2      ref     CountryCode     CountryCode     14      test.t1.Code    1       Using where; FirstMatch(t1)
 
339
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    31      Using where
 
340
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    125     Using where
341
341
SELECT Name FROM t1 
342
342
WHERE t1.Code IN (
343
343
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);