~posulliv/drizzle/memcached_applier

« back to all changes in this revision

Viewing changes to tests/r/subselect.result

  • Committer: Jay Pipes
  • Date: 2009-08-03 14:23:22 UTC
  • mfrom: (1039.2.68 staging)
  • mto: This revision was merged to the branch mainline in revision 1078.
  • Revision ID: jpipes@serialcoder-20090803142322-1g67h7su9mocg9ig
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1266
1266
4
1267
1267
explain extended select * from t2 where t2.a in (select a from t1);
1268
1268
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
1269
 
1       PRIMARY t2      index   PRIMARY PRIMARY 4       NULL    4       100.00  Using index
1270
 
1       PRIMARY t1      index   PRIMARY PRIMARY 4       NULL    4       75.00   Using where; Using index; Using join buffer
 
1269
1       PRIMARY t2      index   NULL    PRIMARY 4       NULL    4       100.00  Using where; Using index
 
1270
2       SUBQUERY        t1      index   NULL    PRIMARY 4       NULL    4       100.00  Using index
1271
1271
Warnings:
1272
 
Note    1003    select `test`.`t2`.`a` AS `a` from (`test`.`t1`) join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)
 
1272
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key)))
1273
1273
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1274
1274
a
1275
1275
2
1276
1276
4
1277
1277
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1278
1278
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
1279
 
1       PRIMARY t2      index   PRIMARY PRIMARY 4       NULL    4       100.00  Using index
1280
 
1       PRIMARY t1      ALL     PRIMARY NULL    NULL    NULL    4       75.00   Using where; Using join buffer
 
1279
1       PRIMARY t2      index   NULL    PRIMARY 4       NULL    4       100.00  Using where; Using index
 
1280
2       SUBQUERY        t1      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
1281
1281
Warnings:
1282
 
Note    1003    select `test`.`t2`.`a` AS `a` from (`test`.`t1`) join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
 
1282
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key)))
1283
1283
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
1284
1284
a
1285
1285
2
1286
1286
3
1287
1287
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
1288
1288
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
1289
 
1       PRIMARY t2      index   PRIMARY PRIMARY 4       NULL    4       100.00  Using index
1290
 
1       PRIMARY t1      ALL     PRIMARY NULL    NULL    NULL    4       75.00   Using where; Using join buffer
1291
 
1       PRIMARY t3      eq_ref  PRIMARY PRIMARY 4       test.t1.b       1       100.00  Using index
 
1289
1       PRIMARY t2      index   NULL    PRIMARY 4       NULL    4       100.00  Using where; Using index
 
1290
2       SUBQUERY        t3      index   PRIMARY PRIMARY 4       NULL    3       100.00  Using index
 
1291
2       SUBQUERY        t1      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where; Using join buffer
1292
1292
Warnings:
1293
 
Note    1003    select `test`.`t2`.`a` AS `a` from (`test`.`t1` join `test`.`t3`) join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`b`))
 
1293
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key)))
1294
1294
drop table t1, t2, t3;
1295
1295
create temporary table t1 (a int, b int, index a (a,b)) ENGINE=MyISAM;
1296
1296
create temporary table t2 (a int, index a (a)) ENGINE=MyISAM;
1306
1306
4
1307
1307
explain extended select * from t2 where t2.a in (select a from t1);
1308
1308
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
1309
 
1       PRIMARY t2      index   a       a       5       NULL    4       100.00  Using index
1310
 
1       PRIMARY t1      ref     a       a       5       test.t2.a       101     100.00  Using index; FirstMatch(t2)
 
1309
1       PRIMARY t2      index   NULL    a       5       NULL    4       100.00  Using where; Using index
 
1310
2       SUBQUERY        t1      index   NULL    a       10      NULL    10004   100.00  Using index
1311
1311
Warnings:
1312
 
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`t2`.`a`)
 
1312
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key)))
1313
1313
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1314
1314
a
1315
1315
2
1316
1316
4
1317
1317
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1318
1318
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
1319
 
1       PRIMARY t2      index   a       a       5       NULL    4       100.00  Using index
1320
 
1       PRIMARY t1      ref     a       a       5       test.t2.a       101     100.00  Using where; Using index; FirstMatch(t2)
 
1319
1       PRIMARY t2      index   NULL    a       5       NULL    4       100.00  Using where; Using index
 
1320
2       SUBQUERY        t1      index   NULL    a       10      NULL    10004   100.00  Using where; Using index
1321
1321
Warnings:
1322
 
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
 
1322
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key)))
1323
1323
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
1324
1324
a
1325
1325
2
1326
1326
3
1327
1327
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
1328
1328
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
1329
 
1       PRIMARY t2      index   a       a       5       NULL    4       100.00  Using index; Start temporary
1330
 
1       PRIMARY t1      ref     a       a       5       test.t2.a       101     100.00  Using index; FirstMatch(t2)
1331
 
1       PRIMARY t3      index   a       a       5       NULL    3       100.00  Using where; Using index; End temporary; Using join buffer
 
1329
1       PRIMARY t2      index   NULL    a       5       NULL    4       100.00  Using where; Using index
 
1330
2       SUBQUERY        t3      index   a       a       5       NULL    3       100.00  Using index
 
1331
2       SUBQUERY        t1      index   NULL    a       10      NULL    10004   100.00  Using where; Using index; Using join buffer
1332
1332
Warnings:
1333
 
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`b`))
 
1333
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key)))
1334
1334
insert into t1 values (3,31);
1335
1335
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1336
1336
a
1343
1343
4
1344
1344
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1345
1345
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
1346
 
1       PRIMARY t2      index   a       a       5       NULL    4       100.00  Using index
1347
 
1       PRIMARY t1      ref     a       a       5       test.t2.a       101     100.00  Using where; Using index; FirstMatch(t2)
 
1346
1       PRIMARY t2      index   NULL    a       5       NULL    4       100.00  Using where; Using index
 
1347
2       SUBQUERY        t1      index   NULL    a       10      NULL    10005   100.00  Using where; Using index
1348
1348
Warnings:
1349
 
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
 
1349
Note    1003    select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key)))
1350
1350
drop table t1, t2, t3;
1351
1351
#
1352
1352
# alloc_group_fields() working
2813
2813
Note    1003    select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
2814
2814
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
2815
2815
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
2816
 
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    8       100.00  Start temporary
2817
 
1       PRIMARY t2      ALL     NULL    NULL    NULL    NULL    9       100.00  Using where; End temporary; Using join buffer
 
2816
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    8       100.00  Using where
 
2817
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    9       100.00  Using where
2818
2818
Warnings:
2819
 
Note    1003    select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`two` = `test`.`t1`.`two`) and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`flag` = 'N'))
 
2819
Note    1003    select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = 'N') ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key)))
2820
2820
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
2821
2821
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
2822
2822
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    8       100.00  
4113
4113
INSERT INTO t1 VALUES ('a', 'aaa');
4114
4114
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
4115
4115
a       b
 
4116
a       aa
 
4117
a       aaa
4116
4118
CREATE INDEX I1 ON t1 (a);
4117
4119
CREATE INDEX I2 ON t1 (b);
4118
4120
EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
4119
4121
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
4120
 
1       PRIMARY t1      index   I1      I1      7       NULL    #       Using index; LooseScan
4121
 
1       PRIMARY t1      ref     I2      I2      43      test.t1.a       #       Using where
 
4122
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    #       Using where
 
4123
2       SUBQUERY        t1      index   NULL    I1      7       NULL    #       Using index
4122
4124
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
4123
4125
a       b
 
4126
a       aa
 
4127
a       aaa
4124
4128
CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
4125
4129
INSERT INTO t2 SELECT * FROM t1;
4126
4130
CREATE INDEX I1 ON t2 (a);
4127
4131
CREATE INDEX I2 ON t2 (b);
4128
4132
EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
4129
4133
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
4130
 
1       PRIMARY t2      index   I1      I1      7       NULL    #       Using index; LooseScan
4131
 
1       PRIMARY t2      ref     I2      I2      43      test.t2.a       #       Using where
 
4134
1       PRIMARY t2      ALL     NULL    NULL    NULL    NULL    #       Using where
 
4135
2       SUBQUERY        t2      index   NULL    I1      7       NULL    #       Using index
4132
4136
SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
4133
4137
a       b
 
4138
a       aa
 
4139
a       aaa
4134
4140
EXPLAIN
4135
4141
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
4136
4142
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
4137
 
1       PRIMARY t1      index   I1      I1      7       NULL    #       Using where; Using index; LooseScan
4138
 
1       PRIMARY t1      ref     I2      I2      43      test.t1.a       #       Using where
 
4143
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    #       Using where
 
4144
2       SUBQUERY        t1      index   NULL    I1      7       NULL    #       Using where; Using index
4139
4145
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
4140
4146
a       b
 
4147
a       aa
 
4148
a       aaa
4141
4149
DROP TABLE t1,t2;
4142
4150
#
4143
4151
# Bug #32400: Complex SELECT query returns correct result only on some