~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/subselect_mat.result

  • Committer: Lee
  • Date: 2008-12-30 04:41:07 UTC
  • mto: (754.1.1 devel) (758.1.3 devel)
  • mto: This revision was merged to the branch mainline in revision 755.
  • Revision ID: lbieber@lbieber-desktop-20081230044107-amd1vjad6vysgd1t
update subselect tests to use MyISAM tables since we have issues with optimizer and explain when using InnoDB

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1, t2, t3, t1i, t2i, t3i;
2
 
create table t1 (a1 char(8), a2 char(8));
3
 
create table t2 (b1 char(8), b2 char(8));
4
 
create table t3 (c1 char(8), c2 char(8));
 
2
create table t1 (a1 char(8), a2 char(8)) ENGINE=MyISAM;
 
3
create table t2 (b1 char(8), b2 char(8)) ENGINE=MyISAM;
 
4
create table t3 (c1 char(8), c2 char(8)) ENGINE=MyISAM;
5
5
insert into t1 values ('1 - 00', '2 - 00');
6
6
insert into t1 values ('1 - 01', '2 - 01');
7
7
insert into t1 values ('1 - 02', '2 - 02');
14
14
insert into t3 values ('1 - 02', '2 - 02');
15
15
insert into t3 values ('1 - 03', '2 - 03');
16
16
insert into t3 values ('1 - 04', '2 - 04');
17
 
create table t1i (a1 char(8), a2 char(8));
18
 
create table t2i (b1 char(8), b2 char(8));
19
 
create table t3i (c1 char(8), c2 char(8));
 
17
create table t1i (a1 char(8), a2 char(8)) ENGINE=MyISAM;
 
18
create table t2i (b1 char(8), b2 char(8)) ENGINE=MyISAM;
 
19
create table t3i (c1 char(8), c2 char(8)) ENGINE=MyISAM;
20
20
create index it1i1 on t1i (a1);
21
21
create index it1i2 on t1i (a2);
22
22
create index it1i3 on t1i (a1, a2);
82
82
select * from t1i where a1 in (select b1 from t2i where b1 > '0');
83
83
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
84
84
1       PRIMARY t1i     index   NULL    it1i3   70      NULL    3       100.00  Using where; Using index
85
 
2       SUBQUERY        t2i     index   it2i1,it2i3     it2i1   35      NULL    5       40.00   Using where; Using index
 
85
2       SUBQUERY        t2i     index   it2i1,it2i3     it2i1   35      NULL    5       100.00  Using where; Using index
86
86
Warnings:
87
87
Note    1003    select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` AS `b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key)))
88
88
select * from t1i where a1 in (select b1 from t2i where b1 > '0');
93
93
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
94
94
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
95
95
1       PRIMARY t1i     index   NULL    it1i3   70      NULL    3       100.00  Using where; Using index
96
 
2       SUBQUERY        t2i     range   it2i1,it2i3     it2i1   35      NULL    2       100.00  Using where; Using index for group-by
 
96
2       SUBQUERY        t2i     range   it2i1,it2i3     it2i1   35      NULL    3       100.00  Using where; Using index for group-by
97
97
Warnings:
98
98
Note    1003    select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` AS `b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key)))
99
99
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
104
104
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
105
105
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
106
106
1       PRIMARY t1i     index   NULL    it1i3   70      NULL    3       100.00  Using where; Using index
107
 
2       SUBQUERY        t2i     index   it2i1,it2i3     it2i3   70      NULL    5       40.00   Using where; Using index
 
107
2       SUBQUERY        t2i     index   it2i1,it2i3     it2i3   70      NULL    5       100.00  Using where; Using index
108
108
Warnings:
109
109
Note    1003    select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key)))
110
110
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
115
115
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
116
116
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
117
117
1       PRIMARY t1i     index   NULL    it1i3   70      NULL    3       100.00  Using where; Using index
118
 
2       SUBQUERY        t2i     range   it2i1,it2i3     it2i3   70      NULL    2       100.00  Using where; Using index for group-by
 
118
2       SUBQUERY        t2i     range   it2i1,it2i3     it2i3   70      NULL    3       100.00  Using where; Using index for group-by
119
119
Warnings:
120
120
Note    1003    select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key)))
121
121
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
126
126
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
127
127
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
128
128
1       PRIMARY t1i     index   NULL    it1i3   70      NULL    3       100.00  Using where; Using index
129
 
2       SUBQUERY        t2i     range   it2i1,it2i3     it2i3   70      NULL    2       100.00  Using where; Using index for group-by
 
129
2       SUBQUERY        t2i     range   it2i1,it2i3     it2i3   70      NULL    3       100.00  Using where; Using index for group-by
130
130
Warnings:
131
131
Note    1003    select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key)))
132
132
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
163
163
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
164
164
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
165
165
3       SUBQUERY        t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
166
 
4       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.00   Using where; Using index
 
166
4       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       100.00  Using where; Using index
167
167
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where
168
168
Warnings:
169
169
Note    1003    select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key))))
182
182
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
183
183
1       PRIMARY t1i     index   NULL    it1i3   70      NULL    3       100.00  Using where; Using index
184
184
3       SUBQUERY        t3i     index   NULL    it3i3   70      NULL    4       100.00  Using where; Using index
185
 
4       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.00   Using where; Using index
186
 
2       SUBQUERY        t2i     index   it2i1,it2i3     it2i3   70      NULL    5       40.00   Using where; Using index
 
185
4       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       100.00  Using where; Using index
 
186
2       SUBQUERY        t2i     index   it2i1,it2i3     it2i3   70      NULL    5       100.00  Using where; Using index
187
187
Warnings:
188
188
Note    1003    select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key))) and <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1` AS `c1`,`test`.`t3i`.`c2` AS `c2` from `test`.`t3i` where <in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key))))
189
189
select * from t1i
203
203
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
204
204
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
205
205
5       SUBQUERY        t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
206
 
6       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.00   Using where; Using index
 
206
6       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       100.00  Using where; Using index
207
207
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where
208
208
4       SUBQUERY        t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
209
209
3       SUBQUERY        t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
227
227
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
228
228
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
229
229
5       SUBQUERY        t3c     ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
230
 
6       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.00   Using where; Using index
 
230
6       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       100.00  Using where; Using index
231
231
2       DEPENDENT SUBQUERY      t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where
232
232
4       SUBQUERY        t3b     ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
233
233
3       DEPENDENT SUBQUERY      t3a     ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
259
259
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
260
260
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
261
261
5       SUBQUERY        t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
262
 
6       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.00   Using where; Using index
 
262
6       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       100.00  Using where; Using index
263
263
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where; Using temporary; Using filesort
264
264
4       SUBQUERY        t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
265
265
3       SUBQUERY        t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
266
266
7       UNION   t1i     index   NULL    it1i3   70      NULL    3       100.00  Using where; Using index
267
267
9       SUBQUERY        t3i     index   NULL    it3i3   70      NULL    4       100.00  Using where; Using index
268
 
10      SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.00   Using where; Using index
269
 
8       SUBQUERY        t2i     index   it2i1,it2i3     it2i3   70      NULL    5       40.00   Using where; Using index
 
268
10      SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       100.00  Using where; Using index
 
269
8       SUBQUERY        t2i     index   it2i1,it2i3     it2i3   70      NULL    5       100.00  Using where; Using index
270
270
NULL    UNION RESULT    <union1,7>      ALL     NULL    NULL    NULL    NULL    NULL    NULL    
271
271
Warnings:
272
272
Note    1003    (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key)))) group by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key))))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key))) and <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1` AS `c1`,`test`.`t3i`.`c2` AS `c2` from `test`.`t3i` where <in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key)))))
293
293
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
294
294
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
295
295
4       SUBQUERY        t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
296
 
5       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.00   Using where; Using index
 
296
5       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       100.00  Using where; Using index
297
297
2       DEPENDENT SUBQUERY      t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
298
298
3       DEPENDENT UNION t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where
299
299
NULL    UNION RESULT    <union2,3>      ALL     NULL    NULL    NULL    NULL    NULL    NULL    
316
316
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
317
317
1       PRIMARY t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where; Using join buffer
318
318
4       SUBQUERY        t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
319
 
5       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.00   Using where; Using index
 
319
5       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       100.00  Using where; Using index
320
320
2       DEPENDENT SUBQUERY      t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
321
321
3       DEPENDENT UNION t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where
322
322
NULL    UNION RESULT    <union2,3>      ALL     NULL    NULL    NULL    NULL    NULL    NULL    
388
388
0
389
389
0
390
390
/* GROUP BY clause */
391
 
create table columns (col int key);
 
391
create table columns (col int key) ENGINE=MyISAM;
392
392
insert into columns values (1), (2);
393
393
explain extended
394
394
select * from t1 group by (select col from columns limit 1);
434
434
set @prefix_len = 6;
435
435
set @blob_len = 16;
436
436
set @suffix_len = @blob_len - @prefix_len;
437
 
create table t1_16 (a1 blob, a2 blob);
438
 
create table t2_16 (b1 blob, b2 blob);
439
 
create table t3_16 (c1 blob, c2 blob);
 
437
create table t1_16 (a1 blob, a2 blob) ENGINE=MyISAM;
 
438
create table t2_16 (b1 blob, b2 blob) ENGINE=MyISAM;
 
439
create table t3_16 (c1 blob, c2 blob) ENGINE=MyISAM;
440
440
insert into t1_16 values
441
441
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
442
442
insert into t1_16 values
547
547
drop table t1_16, t2_16, t3_16;
548
548
set @blob_len = 512;
549
549
set @suffix_len = @blob_len - @prefix_len;
550
 
create table t1_512 (a1 blob, a2 blob);
551
 
create table t2_512 (b1 blob, b2 blob);
552
 
create table t3_512 (c1 blob, c2 blob);
 
550
create table t1_512 (a1 blob, a2 blob) ENGINE=MyISAM;
 
551
create table t2_512 (b1 blob, b2 blob) ENGINE=MyISAM;
 
552
create table t3_512 (c1 blob, c2 blob) ENGINE=MyISAM;
553
553
insert into t1_512 values
554
554
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
555
555
insert into t1_512 values
644
644
drop table t1_512, t2_512, t3_512;
645
645
set @blob_len = 1024;
646
646
set @suffix_len = @blob_len - @prefix_len;
647
 
create table t1_1024 (a1 blob, a2 blob);
648
 
create table t2_1024 (b1 blob, b2 blob);
649
 
create table t3_1024 (c1 blob, c2 blob);
 
647
create table t1_1024 (a1 blob, a2 blob) ENGINE=MyISAM;
 
648
create table t2_1024 (b1 blob, b2 blob) ENGINE=MyISAM;
 
649
create table t3_1024 (c1 blob, c2 blob) ENGINE=MyISAM;
650
650
insert into t1_1024 values
651
651
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
652
652
insert into t1_1024 values
741
741
drop table t1_1024, t2_1024, t3_1024;
742
742
set @blob_len = 1025;
743
743
set @suffix_len = @blob_len - @prefix_len;
744
 
create table t1_1025 (a1 blob, a2 blob);
745
 
create table t2_1025 (b1 blob, b2 blob);
746
 
create table t3_1025 (c1 blob, c2 blob);
 
744
create table t1_1025 (a1 blob, a2 blob) ENGINE=MyISAM;
 
745
create table t2_1025 (b1 blob, b2 blob) ENGINE=MyISAM;
 
746
create table t3_1025 (c1 blob, c2 blob) ENGINE=MyISAM;
747
747
insert into t1_1025 values
748
748
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
749
749
insert into t1_1025 values
841
841
* Test the cache of the left operand of IN.
842
842
******************************************************************************/
843
843
set @@optimizer_switch=no_semijoin;
844
 
create table t1 (s1 int);
845
 
create table t2 (s2 int);
 
844
create table t1 (s1 int) ENGINE=MyISAM;
 
845
create table t2 (s2 int) ENGINE=MyISAM;
846
846
insert into t1 values (5),(1),(0);
847
847
insert into t2 values (0), (1);
848
848
select s2 from t2 where s2 in (select s1 from t1);
850
850
0
851
851
1
852
852
drop table t1, t2;
853
 
create table t1 (a int not null, b int not null);
854
 
create table t2 (c int not null, d int not null);
855
 
create table t3 (e int not null);
 
853
create table t1 (a int not null, b int not null) ENGINE=MyISAM;
 
854
create table t2 (c int not null, d int not null) ENGINE=MyISAM;
 
855
create table t3 (e int not null) ENGINE=MyISAM;
856
856
insert into t1 values (1,10);
857
857
insert into t1 values (1,20);
858
858
insert into t1 values (2,10);
914
914
explain extended
915
915
select a from t1 group by a having a in (select c from t2 where d >= 20);
916
916
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
917
 
1       PRIMARY t1      range   NULL    it1a    4       NULL    3       100.00  Using index for group-by
 
917
1       PRIMARY t1      index   NULL    it1a    4       NULL    7       100.00  Using index
918
918
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    7       100.00  Using where
919
919
Warnings:
920
920
Note    1003    select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key)))
926
926
explain extended
927
927
select a from t1 group by a having a in (select c from t2 where d >= 20);
928
928
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
929
 
1       PRIMARY t1      range   NULL    it1a    4       NULL    3       100.00  Using index for group-by
 
929
1       PRIMARY t1      index   NULL    it1a    4       NULL    7       100.00  Using index
930
930
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    7       100.00  Using where
931
931
Warnings:
932
932
Note    1003    select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key)))
938
938
select a from t1 group by a
939
939
having a in (select c from t2 where d >= some(select e from t3 where max(b)=e));
940
940
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
941
 
1       PRIMARY t1      range   NULL    iab     4       NULL    3       100.00  Using index for group-by
 
941
1       PRIMARY t1      index   NULL    iab     8       NULL    7       100.00  Using index
942
942
2       DEPENDENT SUBQUERY      t2      ALL     NULL    NULL    NULL    NULL    7       100.00  Using where
943
943
3       DEPENDENT SUBQUERY      t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
944
944
Warnings: