~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/subselect_mat.result

enable subselect_not, subselect_no_mat and variables tests, some other misc clean up on other tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
41
41
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where
42
42
Warnings:
43
 
Note    1003    select "test"."t1"."a1" AS "a1","test"."t1"."a2" AS "a2" from "test"."t1" where <in_optimizer>("test"."t1"."a1","test"."t1"."a1" in ( <materialize> (select "test"."t2"."b1" AS "b1" from "test"."t2" where ("test"."t2"."b1" > '0') ), <primary_index_lookup>("test"."t1"."a1" in <temporary table> on distinct_key)))
 
43
Note    1003    select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` AS `b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key)))
44
44
select * from t1 where a1 in (select b1 from t2 where b1 > '0');
45
45
a1      a2
46
46
1 - 01  2 - 01
51
51
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
52
52
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where; Using temporary; Using filesort
53
53
Warnings:
54
 
Note    1003    select "test"."t1"."a1" AS "a1","test"."t1"."a2" AS "a2" from "test"."t1" where <in_optimizer>("test"."t1"."a1","test"."t1"."a1" in ( <materialize> (select "test"."t2"."b1" AS "b1" from "test"."t2" where ("test"."t2"."b1" > '0') group by "test"."t2"."b1" ), <primary_index_lookup>("test"."t1"."a1" in <temporary table> on distinct_key)))
 
54
Note    1003    select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` AS `b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key)))
55
55
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
56
56
a1      a2
57
57
1 - 01  2 - 01
62
62
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
63
63
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where; Using temporary; Using filesort
64
64
Warnings:
65
 
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') group by "test"."t2"."b1","test"."t2"."b2" ), <primary_index_lookup>("test"."t1"."a1" in <temporary table> on distinct_key)))
 
65
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') group by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key)))
66
66
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
67
67
a1      a2
68
68
1 - 01  2 - 01
73
73
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
74
74
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where; Using temporary; Using filesort
75
75
Warnings:
76
 
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",min("test"."t2"."b2") AS "min(b2)" from "test"."t2" where ("test"."t2"."b1" > '0') group by "test"."t2"."b1" ), <primary_index_lookup>("test"."t1"."a1" in <temporary table> on distinct_key)))
 
76
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`,min(`test`.`t2`.`b2`) AS `min(b2)` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key)))
77
77
select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
78
78
a1      a2
79
79
1 - 01  2 - 01
81
81
explain extended
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
 
1       PRIMARY t1i     index   NULL    it1i3   18      NULL    3       100.00  Using where; Using index
85
 
2       SUBQUERY        t2i     index   it2i1,it2i3     it2i1   9       NULL    5       100.00  Using where; Using index
 
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
86
86
Warnings:
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)))
 
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');
89
89
a1      a2
90
90
1 - 01  2 - 01
92
92
explain extended
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
 
1       PRIMARY t1i     index   NULL    it1i3   18      NULL    3       100.00  Using where; Using index
96
 
2       SUBQUERY        t2i     range   it2i1,it2i3     it2i1   9       NULL    3       100.00  Using where; Using index for group-by
97
 
Warnings:
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
 
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
100
 
a1      a2
101
 
1 - 01  2 - 01
102
 
1 - 02  2 - 02
103
 
explain extended
104
 
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
105
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
106
 
1       PRIMARY t1i     index   NULL    it1i3   18      NULL    3       100.00  Using where; Using index
107
 
2       SUBQUERY        t2i     index   it2i1,it2i3     it2i3   18      NULL    5       100.00  Using where; Using index
108
 
Warnings:
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
 
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
111
 
a1      a2
112
 
1 - 01  2 - 01
113
 
1 - 02  2 - 02
114
 
explain extended
115
 
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
116
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
117
 
1       PRIMARY t1i     index   NULL    it1i3   18      NULL    3       100.00  Using where; Using index
118
 
2       SUBQUERY        t2i     range   it2i1,it2i3     it2i3   18      NULL    3       100.00  Using where; Using index for group-by
119
 
Warnings:
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
 
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
122
 
a1      a2
123
 
1 - 01  2 - 01
124
 
1 - 02  2 - 02
125
 
explain extended
126
 
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
127
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
128
 
1       PRIMARY t1i     index   NULL    it1i3   18      NULL    3       100.00  Using where; Using index
129
 
2       SUBQUERY        t2i     range   it2i1,it2i3     it2i3   18      NULL    3       100.00  Using where; Using index for group-by
130
 
Warnings:
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
 
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
133
 
a1      a2
134
 
1 - 01  2 - 01
135
 
1 - 02  2 - 02
136
 
explain extended
 
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
 
97
Warnings:
 
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
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
 
100
a1      a2
 
101
1 - 01  2 - 01
 
102
1 - 02  2 - 02
 
103
explain extended
 
104
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
 
105
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
 
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
 
108
Warnings:
 
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
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
 
111
a1      a2
 
112
1 - 01  2 - 01
 
113
1 - 02  2 - 02
 
114
explain extended
 
115
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
 
116
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
 
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
 
119
Warnings:
 
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
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
 
122
a1      a2
 
123
1 - 01  2 - 01
 
124
1 - 02  2 - 02
 
125
explain extended
 
126
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
 
127
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
 
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
 
130
Warnings:
 
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
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
 
133
a1      a2
 
134
1 - 01  2 - 01
 
135
1 - 02  2 - 02
 
136
explain extended
137
137
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
138
138
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
139
139
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
140
140
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    5       100.00  
141
141
Warnings:
142
 
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" order by "test"."t2"."b1","test"."t2"."b2" ), <primary_index_lookup>("test"."t1"."a1" in <temporary table> on distinct_key)))
 
142
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` order by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key)))
143
143
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
144
144
a1      a2
145
145
1 - 01  2 - 01
147
147
explain extended
148
148
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
149
149
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
150
 
1       PRIMARY t1i     index   NULL    it1i3   18      NULL    3       100.00  Using where; Using index
151
 
2       SUBQUERY        t2i     index   NULL    it2i3   18      NULL    5       100.00  Using index
 
150
1       PRIMARY t1i     index   NULL    it1i3   70      NULL    3       100.00  Using where; Using index
 
151
2       SUBQUERY        t2i     index   NULL    it2i3   70      NULL    5       100.00  Using index
152
152
Warnings:
153
 
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" order by "test"."t2i"."b1","test"."t2i"."b2" ), <primary_index_lookup>("test"."t1i"."a1" in <temporary table> on distinct_key)))
 
153
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` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key)))
154
154
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
155
155
a1      a2
156
156
1 - 01  2 - 01
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   18      NULL    5       100.00  Using where; Using index
 
166
4       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.00   Using where; Using index
167
167
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where
168
168
Warnings:
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))))
 
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))))
170
170
select * from t1
171
171
where (a1, a2) in (select b1, b2 from t2 where b1 >  '0') and
172
172
(a1, a2) in (select c1, c2 from t3
180
180
(a1, a2) in (select c1, c2 from t3i
181
181
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
182
182
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
183
 
1       PRIMARY t1i     index   NULL    it1i3   18      NULL    3       100.00  Using where; Using index
184
 
3       SUBQUERY        t3i     index   NULL    it3i3   18      NULL    4       100.00  Using where; Using index
185
 
4       SUBQUERY        t2i     index   it2i2   it2i3   18      NULL    5       100.00  Using where; Using index
186
 
2       SUBQUERY        t2i     index   it2i1,it2i3     it2i3   18      NULL    5       100.00  Using where; Using index
 
183
1       PRIMARY t1i     index   NULL    it1i3   70      NULL    3       100.00  Using where; Using index
 
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
187
187
Warnings:
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))))
 
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
190
190
where (a1, a2) in (select b1, b2 from t2i where b1 >  '0') and
191
191
(a1, a2) in (select c1, c2 from t3i
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   18      NULL    5       100.00  Using where; Using index
 
206
6       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.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
210
210
Warnings:
211
 
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)))) ), <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))))
 
211
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)))) ), <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))))
212
212
select * from t1
213
213
where (a1, a2) in (select b1, b2 from t2
214
214
where b2 in (select c2 from t3 where c2 LIKE '%02') or
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   18      NULL    5       100.00  Using where; Using index
 
230
6       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.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
234
234
Warnings:
235
235
Note    1276    Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
236
 
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"),<exists>(select "test"."t2"."b1" AS "b1","test"."t2"."b2" AS "b2" from "test"."t2" where ((<in_optimizer>("test"."t2"."b2",<exists>(select 1 AS "Not_used" from "test"."t3" "t3a" where (("test"."t3a"."c1" = "test"."t1"."a1") and (<cache>("test"."t2"."b2") = "test"."t3a"."c2")))) or <in_optimizer>("test"."t2"."b2","test"."t2"."b2" in ( <materialize> (select "test"."t3b"."c2" AS "c2" from "test"."t3" "t3b" where ("test"."t3b"."c2" like '%03') ), <primary_index_lookup>("test"."t2"."b2" in <temporary table> on distinct_key)))) and (<cache>("test"."t1"."a1") = "test"."t2"."b1") and (<cache>("test"."t1"."a2") = "test"."t2"."b2")))) and <in_optimizer>(("test"."t1"."a1","test"."t1"."a2"),("test"."t1"."a1","test"."t1"."a2") in ( <materialize> (select "test"."t3c"."c1" AS "c1","test"."t3c"."c2" AS "c2" from "test"."t3" "t3c" where <in_optimizer>(("test"."t3c"."c1","test"."t3c"."c2"),("test"."t3c"."c1","test"."t3c"."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"."t3c"."c1" in <temporary table> on distinct_key))) ), <primary_index_lookup>("test"."t1"."a1" in <temporary table> on distinct_key))))
 
236
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`),<exists>(select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key)))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3c`.`c1` AS `c1`,`test`.`t3c`.`c2` AS `c2` from `test`.`t3` `t3c` where <in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(`test`.`t3c`.`c1`,`test`.`t3c`.`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`.`t3c`.`c1` in <temporary table> on distinct_key))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key))))
237
237
select * from t1
238
238
where (a1, a2) in (select b1, b2 from t2
239
239
where b2 in (select c2 from t3 t3a where c1 = a1) or
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   18      NULL    5       100.00  Using where; Using index
 
262
6       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.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
 
7       UNION   t1i     index   NULL    it1i3   18      NULL    3       100.00  Using where; Using index
267
 
9       SUBQUERY        t3i     index   NULL    it3i3   18      NULL    4       100.00  Using where; Using index
268
 
10      SUBQUERY        t2i     index   it2i2   it2i3   18      NULL    5       100.00  Using where; Using index
269
 
8       SUBQUERY        t2i     index   it2i1,it2i3     it2i3   18      NULL    5       100.00  Using where; Using index
 
266
7       UNION   t1i     index   NULL    it1i3   70      NULL    3       100.00  Using where; Using index
 
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
270
270
NULL    UNION RESULT    <union1,7>      ALL     NULL    NULL    NULL    NULL    NULL    NULL    
271
271
Warnings:
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)))))
 
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)))))
273
273
(select * from t1
274
274
where (a1, a2) in (select b1, b2 from t2
275
275
where b2 in (select c2 from t3 where c2 LIKE '%02') or
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   18      NULL    5       100.00  Using where; Using index
 
296
5       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.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    
300
300
Warnings:
301
 
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"),<exists>(select "test"."t1"."a1" AS "a1","test"."t1"."a2" AS "a2" from "test"."t1" where (("test"."t1"."a1" > '0') and (<cache>("test"."t1"."a1") = "test"."t1"."a1") and (<cache>("test"."t1"."a2") = "test"."t1"."a2")) union select "test"."t2"."b1" AS "b1","test"."t2"."b2" AS "b2" from "test"."t2" where (("test"."t2"."b1" < '9') and (<cache>("test"."t1"."a1") = "test"."t2"."b1") and (<cache>("test"."t1"."a2") = "test"."t2"."b2")))) 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))))
 
301
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`),<exists>(select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) 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))))
302
302
select * from t1
303
303
where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
304
304
(a1, a2) in (select c1, c2 from t3
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   18      NULL    5       100.00  Using where; Using index
 
319
5       SUBQUERY        t2i     index   it2i2   it2i3   70      NULL    5       40.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    
323
323
Warnings:
324
 
Note    1003    select "test"."t1"."a1" AS "a1","test"."t1"."a2" AS "a2","test"."t3"."c1" AS "c1","test"."t3"."c2" AS "c2" from "test"."t1" join "test"."t3" where (("test"."t3"."c1" = "test"."t1"."a1") and <in_optimizer>(("test"."t1"."a1","test"."t1"."a2"),<exists>(select "test"."t1"."a1" AS "a1","test"."t1"."a2" AS "a2" from "test"."t1" where (("test"."t1"."a1" > '0') and (<cache>("test"."t1"."a1") = "test"."t1"."a1") and (<cache>("test"."t1"."a2") = "test"."t1"."a2")) union select "test"."t2"."b1" AS "b1","test"."t2"."b2" AS "b2" from "test"."t2" where (("test"."t2"."b1" < '9') and (<cache>("test"."t1"."a1") = "test"."t2"."b1") and (<cache>("test"."t1"."a2") = "test"."t2"."b2")))) and <in_optimizer>(("test"."t3"."c1","test"."t3"."c2"),("test"."t3"."c1","test"."t3"."c2") 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"."t3"."c1" in <temporary table> on distinct_key))))
 
324
Note    1003    select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) 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`.`t3`.`c1` in <temporary table> on distinct_key))))
325
325
select * from t1, t3
326
326
where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
327
327
(c1, c2) in (select c1, c2 from t3
343
343
3       DEPENDENT UNION t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where
344
344
NULL    UNION RESULT    <union2,3>      ALL     NULL    NULL    NULL    NULL    NULL    NULL    
345
345
Warnings:
346
 
Note    1003    select "test"."t3"."c1" AS "c1","test"."t3"."c2" AS "c2" from "test"."t3" where <in_optimizer>("test"."t3"."c1",<exists>(select 1 AS "Not_used" from "test"."t1" where (("test"."t1"."a1" > '0') and (<cache>("test"."t3"."c1") = "test"."t1"."a1")) union select 1 AS "Not_used" from "test"."t2" where (("test"."t2"."b1" < '9') and (<cache>("test"."t3"."c1") = "test"."t2"."b1"))))
 
346
Note    1003    select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>(`test`.`t3`.`c1`,<exists>(select 1 AS `Not_used` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t3`.`c1`) = `test`.`t1`.`a1`)) union select 1 AS `Not_used` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t3`.`c1`) = `test`.`t2`.`b1`))))
347
347
select * from t3
348
348
where c1 in (select a1 from t1 where a1 > '0' UNION select b1 from t2 where b1 < '9');
349
349
c1      c2
360
360
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
361
361
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
362
362
5       DEPENDENT SUBQUERY      t3c     ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
363
 
6       DEPENDENT SUBQUERY      t2i     index_subquery  it2i1,it2i2,it2i3       it2i3   18      func,func       2       100.00  Using index; Using where
 
363
6       DEPENDENT SUBQUERY      t2i     index_subquery  it2i1,it2i2,it2i3       it2i3   70      func,func       2       100.00  Using index; Using where
364
364
2       DEPENDENT SUBQUERY      t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where
365
365
4       SUBQUERY        t3b     ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
366
366
3       DEPENDENT SUBQUERY      t3a     ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
367
367
Warnings:
368
368
Note    1276    Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
369
369
Note    1276    Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1
370
 
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"),<exists>(select "test"."t2"."b1" AS "b1","test"."t2"."b2" AS "b2" from "test"."t2" where ((<in_optimizer>("test"."t2"."b2",<exists>(select 1 AS "Not_used" from "test"."t3" "t3a" where (("test"."t3a"."c1" = "test"."t1"."a1") and (<cache>("test"."t2"."b2") = "test"."t3a"."c2")))) or <in_optimizer>("test"."t2"."b2","test"."t2"."b2" in ( <materialize> (select "test"."t3b"."c2" AS "c2" from "test"."t3" "t3b" where ("test"."t3b"."c2" like '%03') ), <primary_index_lookup>("test"."t2"."b2" in <temporary table> on distinct_key)))) and (<cache>("test"."t1"."a1") = "test"."t2"."b1") and (<cache>("test"."t1"."a2") = "test"."t2"."b2")))) and <in_optimizer>(("test"."t1"."a1","test"."t1"."a2"),<exists>(select "test"."t3c"."c1" AS "c1","test"."t3c"."c2" AS "c2" from "test"."t3" "t3c" where (<in_optimizer>(("test"."t3c"."c1","test"."t3c"."c2"),<exists>(<index_lookup>(<cache>("test"."t3c"."c1") in t2i on it2i3 where ((("test"."t2i"."b2" > '0') or ("test"."t2i"."b2" = "test"."t1"."a2")) and (<cache>("test"."t3c"."c1") = "test"."t2i"."b1") and (<cache>("test"."t3c"."c2") = "test"."t2i"."b2"))))) and (<cache>("test"."t1"."a1") = "test"."t3c"."c1") and (<cache>("test"."t1"."a2") = "test"."t3c"."c2")))))
371
 
explain extended
372
 
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
373
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
374
 
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
375
 
2       DEPENDENT SUBQUERY      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
376
 
Warnings:
377
 
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"),<exists>(select '1 - 01' AS "1 - 01",'2 - 01' AS "2 - 01" having ((<cache>("test"."t1"."a1") = '1 - 01') and (<cache>("test"."t1"."a2") = '2 - 01'))))
378
 
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
379
 
a1      a2
380
 
1 - 01  2 - 01
381
 
explain extended
382
 
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual);
383
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
384
 
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
385
 
2       DEPENDENT SUBQUERY      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
386
 
Warnings:
387
 
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"),<exists>(select '1 - 01' AS "1 - 01",'2 - 01' AS "2 - 01" having ((<cache>("test"."t1"."a1") = '1 - 01') and (<cache>("test"."t1"."a2") = '2 - 01'))))
388
 
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual);
 
370
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`),<exists>(select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key)))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t3c`.`c1` AS `c1`,`test`.`t3c`.`c2` AS `c2` from `test`.`t3` `t3c` where (<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),<exists>(<index_lookup>(<cache>(`test`.`t3c`.`c1`) in t2i on it2i3 where (((`test`.`t2i`.`b2` > '0') or (`test`.`t2i`.`b2` = `test`.`t1`.`a2`)) and (<cache>(`test`.`t3c`.`c1`) = `test`.`t2i`.`b1`) and (<cache>(`test`.`t3c`.`c2`) = `test`.`t2i`.`b2`))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t3c`.`c1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t3c`.`c2`)))))
 
371
explain extended
 
372
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
 
373
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
 
374
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
 
375
2       DEPENDENT SUBQUERY      NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
 
376
Warnings:
 
377
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`),<exists>(select '1 - 01' AS `1 - 01`,'2 - 01' AS `2 - 01` having ((<cache>(`test`.`t1`.`a1`) = '1 - 01') and (<cache>(`test`.`t1`.`a2`) = '2 - 01'))))
 
378
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
389
379
a1      a2
390
380
1 - 01  2 - 01
391
381
/******************************************************************************
406
396
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  
407
397
2       SUBQUERY        columns index   NULL    PRIMARY 4       NULL    2       100.00  Using index
408
398
Warnings:
409
 
Note    1003    select "test"."t1"."a1" AS "a1","test"."t1"."a2" AS "a2" from "test"."t1" group by (select "test"."columns"."col" AS "col" from "test"."columns" limit 1)
 
399
Note    1003    select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by (select `test`.`columns`.`col` AS `col` from `test`.`columns` limit 1)
410
400
select * from t1 group by (select col from columns limit 1);
411
401
a1      a2
412
402
1 - 00  2 - 00
416
406
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  Using temporary; Using filesort
417
407
2       DEPENDENT SUBQUERY      columns unique_subquery PRIMARY PRIMARY 4       func    1       100.00  Using index; Using where; Full scan on NULL key
418
408
Warnings:
419
 
Note    1003    select "test"."t1"."a1" AS "a1","test"."t1"."a2" AS "a2" from "test"."t1" group by <in_optimizer>("test"."t1"."a1",<exists>(<primary_index_lookup>(<cache>("test"."t1"."a1") in columns on PRIMARY where trigcond((<cache>("test"."t1"."a1") = "test"."columns"."col")))))
 
409
Note    1003    select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <in_optimizer>(`test`.`t1`.`a1`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a1`) in columns on PRIMARY where trigcond((<cache>(`test`.`t1`.`a1`) = `test`.`columns`.`col`)))))
420
410
select * from t1 group by (a1 in (select col from columns));
421
411
a1      a2
422
412
1 - 00  2 - 00
427
417
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    3       100.00  
428
418
2       SUBQUERY        columns index   NULL    PRIMARY 4       NULL    2       100.00  Using index
429
419
Warnings:
430
 
Note    1003    select "test"."t1"."a1" AS "a1","test"."t1"."a2" AS "a2" from "test"."t1" order by (select "test"."columns"."col" AS "col" from "test"."columns" limit 1)
 
420
Note    1003    select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` order by (select `test`.`columns`.`col` AS `col` from `test`.`columns` limit 1)
431
421
select * from t1 order by (select col from columns limit 1);
432
422
a1      a2
433
423
1 - 00  2 - 00
444
434
set @prefix_len = 6;
445
435
set @blob_len = 16;
446
436
set @suffix_len = @blob_len - @prefix_len;
447
 
create table t1_16 (a1 blob(16), a2 blob(16));
448
 
create table t2_16 (b1 blob(16), b2 blob(16));
449
 
create table t3_16 (c1 blob(16), c2 blob(16));
 
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);
450
440
insert into t1_16 values
451
441
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
452
442
insert into t1_16 values
474
464
1       PRIMARY t1_16   ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
475
465
2       DEPENDENT SUBQUERY      t2_16   ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
476
466
Warnings:
477
 
Note    1003    select left("test"."t1_16"."a1",7) AS "left(a1,7)",left("test"."t1_16"."a2",7) AS "left(a2,7)" from "test"."t1_16" where <in_optimizer>("test"."t1_16"."a1","test"."t1_16"."a1" in (select 1 AS "Not_used" from "test"."t2_16" where (("test"."t2_16"."b1" > '0') and (<cache>("test"."t1_16"."a1") = "test"."t2_16"."b1"))))
 
467
Note    1003    select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in (select 1 AS `Not_used` from `test`.`t2_16` where ((`test`.`t2_16`.`b1` > '0') and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`))))
478
468
select left(a1,7), left(a2,7)
479
469
from t1_16
480
470
where a1 in (select b1 from t2_16 where b1 > '0');
488
478
1       PRIMARY t1_16   ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
489
479
2       DEPENDENT SUBQUERY      t2_16   ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
490
480
Warnings:
491
 
Note    1003    select left("test"."t1_16"."a1",7) AS "left(a1,7)",left("test"."t1_16"."a2",7) AS "left(a2,7)" from "test"."t1_16" where <in_optimizer>(("test"."t1_16"."a1","test"."t1_16"."a2"),("test"."t1_16"."a1","test"."t1_16"."a2") in (select "test"."t2_16"."b1" AS "b1","test"."t2_16"."b2" AS "b2" from "test"."t2_16" where (("test"."t2_16"."b1" > '0') and (<cache>("test"."t1_16"."a1") = "test"."t2_16"."b1") and (<cache>("test"."t1_16"."a2") = "test"."t2_16"."b2"))))
 
481
Note    1003    select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`) in (select `test`.`t2_16`.`b1` AS `b1`,`test`.`t2_16`.`b2` AS `b2` from `test`.`t2_16` where ((`test`.`t2_16`.`b1` > '0') and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and (<cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))))
492
482
select left(a1,7), left(a2,7)
493
483
from t1_16
494
484
where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0');
502
492
1       PRIMARY t1_16   ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
503
493
2       SUBQUERY        t2_16   ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
504
494
Warnings:
505
 
Note    1003    select left("test"."t1_16"."a1",7) AS "left(a1,7)",left("test"."t1_16"."a2",7) AS "left(a2,7)" from "test"."t1_16" where <in_optimizer>("test"."t1_16"."a1","test"."t1_16"."a1" in ( <materialize> (select substr("test"."t2_16"."b1",1,16) AS "substring(b1,1,16)" from "test"."t2_16" where ("test"."t2_16"."b1" > '0') ), <primary_index_lookup>("test"."t1_16"."a1" in <temporary table> on distinct_key)))
 
495
Note    1003    select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select substr(`test`.`t2_16`.`b1`,1,16) AS `substring(b1,1,16)` from `test`.`t2_16` where (`test`.`t2_16`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key)))
506
496
select left(a1,7), left(a2,7)
507
497
from t1_16
508
498
where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0');
516
506
1       PRIMARY t1_16   ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
517
507
2       DEPENDENT SUBQUERY      t2_16   ALL     NULL    NULL    NULL    NULL    3       100.00  Using filesort
518
508
Warnings:
519
 
Note    1003    select left("test"."t1_16"."a1",7) AS "left(a1,7)",left("test"."t1_16"."a2",7) AS "left(a2,7)" from "test"."t1_16" where <in_optimizer>("test"."t1_16"."a1","test"."t1_16"."a1" in (select group_concat("test"."t2_16"."b1" separator ',') AS "group_concat(b1)" from "test"."t2_16" group by "test"."t2_16"."b2" having (<cache>("test"."t1_16"."a1") = <ref_null_helper>(group_concat("test"."t2_16"."b1" separator ',')))))
 
509
Note    1003    select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in (select group_concat(`test`.`t2_16`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_16` group by `test`.`t2_16`.`b2` having (<cache>(`test`.`t1_16`.`a1`) = <ref_null_helper>(group_concat(`test`.`t2_16`.`b1` separator ',')))))
520
510
select left(a1,7), left(a2,7)
521
511
from t1_16
522
512
where a1 in (select group_concat(b1) from t2_16 group by b2);
531
521
1       PRIMARY t1_16   ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
532
522
2       SUBQUERY        t2_16   ALL     NULL    NULL    NULL    NULL    3       100.00  Using filesort
533
523
Warnings:
534
 
Note    1003    select left("test"."t1_16"."a1",7) AS "left(a1,7)",left("test"."t1_16"."a2",7) AS "left(a2,7)" from "test"."t1_16" where <in_optimizer>("test"."t1_16"."a1","test"."t1_16"."a1" in ( <materialize> (select group_concat("test"."t2_16"."b1" separator ',') AS "group_concat(b1)" from "test"."t2_16" group by "test"."t2_16"."b2" ), <primary_index_lookup>("test"."t1_16"."a1" in <temporary table> on distinct_key)))
 
524
Note    1003    select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_16` group by `test`.`t2_16`.`b2` ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key)))
535
525
select left(a1,7), left(a2,7)
536
526
from t1_16
537
527
where a1 in (select group_concat(b1) from t2_16 group by b2);
553
543
3       DEPENDENT SUBQUERY      t2      ALL     NULL    NULL    NULL    NULL    5       100.00  Using where; Using join buffer
554
544
4       SUBQUERY        t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
555
545
Warnings:
556
 
Note    1003    select "test"."t1"."a1" AS "a1","test"."t1"."a2" AS "a2" from "test"."t1" where <in_optimizer>(concat("test"."t1"."a1",'x'),concat("test"."t1"."a1",'x') in ( <materialize> (select left("test"."t1_16"."a1",8) AS "left(a1,8)" from "test"."t1_16" where <in_optimizer>(("test"."t1_16"."a1","test"."t1_16"."a2"),("test"."t1_16"."a1","test"."t1_16"."a2") in (select "test"."t2_16"."b1" AS "b1","test"."t2_16"."b2" AS "b2" from "test"."t2_16" join "test"."t2" where (("test"."t2"."b2" = substr("test"."t2_16"."b2",1,6)) and <in_optimizer>("test"."t2"."b1","test"."t2"."b1" in ( <materialize> (select "test"."t3"."c1" AS "c1" from "test"."t3" where ("test"."t3"."c2" > '0') ), <primary_index_lookup>("test"."t2"."b1" in <temporary table> on distinct_key))) and (<cache>("test"."t1_16"."a1") = "test"."t2_16"."b1") and (<cache>("test"."t1_16"."a2") = "test"."t2_16"."b2")))) ), <primary_index_lookup>(concat("test"."t1"."a1",'x') in <temporary table> on distinct_key)))
 
546
Note    1003    select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(concat(`test`.`t1`.`a1`,'x'),concat(`test`.`t1`.`a1`,'x') in ( <materialize> (select left(`test`.`t1_16`.`a1`,8) AS `left(a1,8)` from `test`.`t1_16` where <in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`) in (select `test`.`t2_16`.`b1` AS `b1`,`test`.`t2_16`.`b2` AS `b2` from `test`.`t2_16` join `test`.`t2` where ((`test`.`t2`.`b2` = substr(`test`.`t2_16`.`b2`,1,6)) and <in_optimizer>(`test`.`t2`.`b1`,`test`.`t2`.`b1` in ( <materialize> (select `test`.`t3`.`c1` AS `c1` from `test`.`t3` where (`test`.`t3`.`c2` > '0') ), <primary_index_lookup>(`test`.`t2`.`b1` in <temporary table> on distinct_key))) and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and (<cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`)))) ), <primary_index_lookup>(concat(`test`.`t1`.`a1`,'x') in <temporary table> on distinct_key)))
557
547
drop table t1_16, t2_16, t3_16;
558
548
set @blob_len = 512;
559
549
set @suffix_len = @blob_len - @prefix_len;
560
 
create table t1_512 (a1 blob(512), a2 blob(512));
561
 
create table t2_512 (b1 blob(512), b2 blob(512));
562
 
create table t3_512 (c1 blob(512), c2 blob(512));
 
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);
563
553
insert into t1_512 values
564
554
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
565
555
insert into t1_512 values
587
577
1       PRIMARY t1_512  ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
588
578
2       DEPENDENT SUBQUERY      t2_512  ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
589
579
Warnings:
590
 
Note    1003    select left("test"."t1_512"."a1",7) AS "left(a1,7)",left("test"."t1_512"."a2",7) AS "left(a2,7)" from "test"."t1_512" where <in_optimizer>("test"."t1_512"."a1","test"."t1_512"."a1" in (select 1 AS "Not_used" from "test"."t2_512" where (("test"."t2_512"."b1" > '0') and (<cache>("test"."t1_512"."a1") = "test"."t2_512"."b1"))))
 
580
Note    1003    select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in (select 1 AS `Not_used` from `test`.`t2_512` where ((`test`.`t2_512`.`b1` > '0') and (<cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`))))
591
581
select left(a1,7), left(a2,7)
592
582
from t1_512
593
583
where a1 in (select b1 from t2_512 where b1 > '0');
601
591
1       PRIMARY t1_512  ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
602
592
2       DEPENDENT SUBQUERY      t2_512  ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
603
593
Warnings:
604
 
Note    1003    select left("test"."t1_512"."a1",7) AS "left(a1,7)",left("test"."t1_512"."a2",7) AS "left(a2,7)" from "test"."t1_512" where <in_optimizer>(("test"."t1_512"."a1","test"."t1_512"."a2"),("test"."t1_512"."a1","test"."t1_512"."a2") in (select "test"."t2_512"."b1" AS "b1","test"."t2_512"."b2" AS "b2" from "test"."t2_512" where (("test"."t2_512"."b1" > '0') and (<cache>("test"."t1_512"."a1") = "test"."t2_512"."b1") and (<cache>("test"."t1_512"."a2") = "test"."t2_512"."b2"))))
 
594
Note    1003    select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`),(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`) in (select `test`.`t2_512`.`b1` AS `b1`,`test`.`t2_512`.`b2` AS `b2` from `test`.`t2_512` where ((`test`.`t2_512`.`b1` > '0') and (<cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`) and (<cache>(`test`.`t1_512`.`a2`) = `test`.`t2_512`.`b2`))))
605
595
select left(a1,7), left(a2,7)
606
596
from t1_512
607
597
where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0');
615
605
1       PRIMARY t1_512  ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
616
606
2       SUBQUERY        t2_512  ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
617
607
Warnings:
618
 
Note    1003    select left("test"."t1_512"."a1",7) AS "left(a1,7)",left("test"."t1_512"."a2",7) AS "left(a2,7)" from "test"."t1_512" where <in_optimizer>("test"."t1_512"."a1","test"."t1_512"."a1" in ( <materialize> (select substr("test"."t2_512"."b1",1,512) AS "substring(b1,1,512)" from "test"."t2_512" where ("test"."t2_512"."b1" > '0') ), <primary_index_lookup>("test"."t1_512"."a1" in <temporary table> on distinct_key)))
 
608
Note    1003    select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select substr(`test`.`t2_512`.`b1`,1,512) AS `substring(b1,1,512)` from `test`.`t2_512` where (`test`.`t2_512`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key)))
619
609
select left(a1,7), left(a2,7)
620
610
from t1_512
621
611
where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0');
629
619
1       PRIMARY t1_512  ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
630
620
2       SUBQUERY        t2_512  ALL     NULL    NULL    NULL    NULL    3       100.00  Using filesort
631
621
Warnings:
632
 
Note    1003    select left("test"."t1_512"."a1",7) AS "left(a1,7)",left("test"."t1_512"."a2",7) AS "left(a2,7)" from "test"."t1_512" where <in_optimizer>("test"."t1_512"."a1","test"."t1_512"."a1" in ( <materialize> (select group_concat("test"."t2_512"."b1" separator ',') AS "group_concat(b1)" from "test"."t2_512" group by "test"."t2_512"."b2" ), <primary_index_lookup>("test"."t1_512"."a1" in <temporary table> on distinct_key)))
 
622
Note    1003    select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key)))
633
623
select left(a1,7), left(a2,7)
634
624
from t1_512
635
625
where a1 in (select group_concat(b1) from t2_512 group by b2);
644
634
1       PRIMARY t1_512  ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
645
635
2       SUBQUERY        t2_512  ALL     NULL    NULL    NULL    NULL    3       100.00  Using filesort
646
636
Warnings:
647
 
Note    1003    select left("test"."t1_512"."a1",7) AS "left(a1,7)",left("test"."t1_512"."a2",7) AS "left(a2,7)" from "test"."t1_512" where <in_optimizer>("test"."t1_512"."a1","test"."t1_512"."a1" in ( <materialize> (select group_concat("test"."t2_512"."b1" separator ',') AS "group_concat(b1)" from "test"."t2_512" group by "test"."t2_512"."b2" ), <primary_index_lookup>("test"."t1_512"."a1" in <temporary table> on distinct_key)))
 
637
Note    1003    select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key)))
648
638
select left(a1,7), left(a2,7)
649
639
from t1_512
650
640
where a1 in (select group_concat(b1) from t2_512 group by b2);
654
644
drop table t1_512, t2_512, t3_512;
655
645
set @blob_len = 1024;
656
646
set @suffix_len = @blob_len - @prefix_len;
657
 
create table t1_1024 (a1 blob(1024), a2 blob(1024));
658
 
create table t2_1024 (b1 blob(1024), b2 blob(1024));
659
 
create table t3_1024 (c1 blob(1024), c2 blob(1024));
 
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);
660
650
insert into t1_1024 values
661
651
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
662
652
insert into t1_1024 values
684
674
1       PRIMARY t1_1024 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
685
675
2       DEPENDENT SUBQUERY      t2_1024 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
686
676
Warnings:
687
 
Note    1003    select left("test"."t1_1024"."a1",7) AS "left(a1,7)",left("test"."t1_1024"."a2",7) AS "left(a2,7)" from "test"."t1_1024" where <in_optimizer>("test"."t1_1024"."a1","test"."t1_1024"."a1" in (select 1 AS "Not_used" from "test"."t2_1024" where (("test"."t2_1024"."b1" > '0') and (<cache>("test"."t1_1024"."a1") = "test"."t2_1024"."b1"))))
 
677
Note    1003    select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in (select 1 AS `Not_used` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`))))
688
678
select left(a1,7), left(a2,7)
689
679
from t1_1024
690
680
where a1 in (select b1 from t2_1024 where b1 > '0');
698
688
1       PRIMARY t1_1024 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
699
689
2       DEPENDENT SUBQUERY      t2_1024 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
700
690
Warnings:
701
 
Note    1003    select left("test"."t1_1024"."a1",7) AS "left(a1,7)",left("test"."t1_1024"."a2",7) AS "left(a2,7)" from "test"."t1_1024" where <in_optimizer>(("test"."t1_1024"."a1","test"."t1_1024"."a2"),("test"."t1_1024"."a1","test"."t1_1024"."a2") in (select "test"."t2_1024"."b1" AS "b1","test"."t2_1024"."b2" AS "b2" from "test"."t2_1024" where (("test"."t2_1024"."b1" > '0') and (<cache>("test"."t1_1024"."a1") = "test"."t2_1024"."b1") and (<cache>("test"."t1_1024"."a2") = "test"."t2_1024"."b2"))))
 
691
Note    1003    select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`),(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`) in (select `test`.`t2_1024`.`b1` AS `b1`,`test`.`t2_1024`.`b2` AS `b2` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`) and (<cache>(`test`.`t1_1024`.`a2`) = `test`.`t2_1024`.`b2`))))
702
692
select left(a1,7), left(a2,7)
703
693
from t1_1024
704
694
where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0');
712
702
1       PRIMARY t1_1024 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
713
703
2       DEPENDENT SUBQUERY      t2_1024 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
714
704
Warnings:
715
 
Note    1003    select left("test"."t1_1024"."a1",7) AS "left(a1,7)",left("test"."t1_1024"."a2",7) AS "left(a2,7)" from "test"."t1_1024" where <in_optimizer>("test"."t1_1024"."a1","test"."t1_1024"."a1" in (select 1 AS "Not_used" from "test"."t2_1024" where (("test"."t2_1024"."b1" > '0') and (<cache>("test"."t1_1024"."a1") = substr("test"."t2_1024"."b1",1,1024)))))
 
705
Note    1003    select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in (select 1 AS `Not_used` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = substr(`test`.`t2_1024`.`b1`,1,1024)))))
716
706
select left(a1,7), left(a2,7)
717
707
from t1_1024
718
708
where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0');
726
716
1       PRIMARY t1_1024 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
727
717
2       SUBQUERY        t2_1024 ALL     NULL    NULL    NULL    NULL    3       100.00  Using filesort
728
718
Warnings:
729
 
Note    1003    select left("test"."t1_1024"."a1",7) AS "left(a1,7)",left("test"."t1_1024"."a2",7) AS "left(a2,7)" from "test"."t1_1024" where <in_optimizer>("test"."t1_1024"."a1","test"."t1_1024"."a1" in ( <materialize> (select group_concat("test"."t2_1024"."b1" separator ',') AS "group_concat(b1)" from "test"."t2_1024" group by "test"."t2_1024"."b2" ), <primary_index_lookup>("test"."t1_1024"."a1" in <temporary table> on distinct_key)))
 
719
Note    1003    select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key)))
730
720
select left(a1,7), left(a2,7)
731
721
from t1_1024
732
722
where a1 in (select group_concat(b1) from t2_1024 group by b2);
741
731
1       PRIMARY t1_1024 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
742
732
2       SUBQUERY        t2_1024 ALL     NULL    NULL    NULL    NULL    3       100.00  Using filesort
743
733
Warnings:
744
 
Note    1003    select left("test"."t1_1024"."a1",7) AS "left(a1,7)",left("test"."t1_1024"."a2",7) AS "left(a2,7)" from "test"."t1_1024" where <in_optimizer>("test"."t1_1024"."a1","test"."t1_1024"."a1" in ( <materialize> (select group_concat("test"."t2_1024"."b1" separator ',') AS "group_concat(b1)" from "test"."t2_1024" group by "test"."t2_1024"."b2" ), <primary_index_lookup>("test"."t1_1024"."a1" in <temporary table> on distinct_key)))
 
734
Note    1003    select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key)))
745
735
select left(a1,7), left(a2,7)
746
736
from t1_1024
747
737
where a1 in (select group_concat(b1) from t2_1024 group by b2);
751
741
drop table t1_1024, t2_1024, t3_1024;
752
742
set @blob_len = 1025;
753
743
set @suffix_len = @blob_len - @prefix_len;
754
 
create table t1_1025 (a1 blob(1025), a2 blob(1025));
755
 
create table t2_1025 (b1 blob(1025), b2 blob(1025));
756
 
create table t3_1025 (c1 blob(1025), c2 blob(1025));
 
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);
757
747
insert into t1_1025 values
758
748
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
759
749
insert into t1_1025 values
781
771
1       PRIMARY t1_1025 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
782
772
2       DEPENDENT SUBQUERY      t2_1025 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
783
773
Warnings:
784
 
Note    1003    select left("test"."t1_1025"."a1",7) AS "left(a1,7)",left("test"."t1_1025"."a2",7) AS "left(a2,7)" from "test"."t1_1025" where <in_optimizer>("test"."t1_1025"."a1","test"."t1_1025"."a1" in (select 1 AS "Not_used" from "test"."t2_1025" where (("test"."t2_1025"."b1" > '0') and (<cache>("test"."t1_1025"."a1") = "test"."t2_1025"."b1"))))
 
774
Note    1003    select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in (select 1 AS `Not_used` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`))))
785
775
select left(a1,7), left(a2,7)
786
776
from t1_1025
787
777
where a1 in (select b1 from t2_1025 where b1 > '0');
795
785
1       PRIMARY t1_1025 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
796
786
2       DEPENDENT SUBQUERY      t2_1025 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
797
787
Warnings:
798
 
Note    1003    select left("test"."t1_1025"."a1",7) AS "left(a1,7)",left("test"."t1_1025"."a2",7) AS "left(a2,7)" from "test"."t1_1025" where <in_optimizer>(("test"."t1_1025"."a1","test"."t1_1025"."a2"),("test"."t1_1025"."a1","test"."t1_1025"."a2") in (select "test"."t2_1025"."b1" AS "b1","test"."t2_1025"."b2" AS "b2" from "test"."t2_1025" where (("test"."t2_1025"."b1" > '0') and (<cache>("test"."t1_1025"."a1") = "test"."t2_1025"."b1") and (<cache>("test"."t1_1025"."a2") = "test"."t2_1025"."b2"))))
 
788
Note    1003    select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`),(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`) in (select `test`.`t2_1025`.`b1` AS `b1`,`test`.`t2_1025`.`b2` AS `b2` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`) and (<cache>(`test`.`t1_1025`.`a2`) = `test`.`t2_1025`.`b2`))))
799
789
select left(a1,7), left(a2,7)
800
790
from t1_1025
801
791
where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0');
809
799
1       PRIMARY t1_1025 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
810
800
2       DEPENDENT SUBQUERY      t2_1025 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
811
801
Warnings:
812
 
Note    1003    select left("test"."t1_1025"."a1",7) AS "left(a1,7)",left("test"."t1_1025"."a2",7) AS "left(a2,7)" from "test"."t1_1025" where <in_optimizer>("test"."t1_1025"."a1","test"."t1_1025"."a1" in (select 1 AS "Not_used" from "test"."t2_1025" where (("test"."t2_1025"."b1" > '0') and (<cache>("test"."t1_1025"."a1") = substr("test"."t2_1025"."b1",1,1025)))))
 
802
Note    1003    select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in (select 1 AS `Not_used` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = substr(`test`.`t2_1025`.`b1`,1,1025)))))
813
803
select left(a1,7), left(a2,7)
814
804
from t1_1025
815
805
where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0');
823
813
1       PRIMARY t1_1025 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
824
814
2       SUBQUERY        t2_1025 ALL     NULL    NULL    NULL    NULL    3       100.00  Using filesort
825
815
Warnings:
826
 
Note    1003    select left("test"."t1_1025"."a1",7) AS "left(a1,7)",left("test"."t1_1025"."a2",7) AS "left(a2,7)" from "test"."t1_1025" where <in_optimizer>("test"."t1_1025"."a1","test"."t1_1025"."a1" in ( <materialize> (select group_concat("test"."t2_1025"."b1" separator ',') AS "group_concat(b1)" from "test"."t2_1025" group by "test"."t2_1025"."b2" ), <primary_index_lookup>("test"."t1_1025"."a1" in <temporary table> on distinct_key)))
 
816
Note    1003    select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key)))
827
817
select left(a1,7), left(a2,7)
828
818
from t1_1025
829
819
where a1 in (select group_concat(b1) from t2_1025 group by b2);
838
828
1       PRIMARY t1_1025 ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
839
829
2       SUBQUERY        t2_1025 ALL     NULL    NULL    NULL    NULL    3       100.00  Using filesort
840
830
Warnings:
841
 
Note    1003    select left("test"."t1_1025"."a1",7) AS "left(a1,7)",left("test"."t1_1025"."a2",7) AS "left(a2,7)" from "test"."t1_1025" where <in_optimizer>("test"."t1_1025"."a1","test"."t1_1025"."a1" in ( <materialize> (select group_concat("test"."t2_1025"."b1" separator ',') AS "group_concat(b1)" from "test"."t2_1025" group by "test"."t2_1025"."b2" ), <primary_index_lookup>("test"."t1_1025"."a1" in <temporary table> on distinct_key)))
 
831
Note    1003    select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key)))
842
832
select left(a1,7), left(a2,7)
843
833
from t1_1025
844
834
where a1 in (select group_concat(b1) from t2_1025 group by b2);
846
836
1 - 01x 2 - 01x
847
837
1 - 02x 2 - 02x
848
838
drop table t1_1025, t2_1025, t3_1025;
849
 
create table t1bit (a1 bit(3), a2 bit(3));
850
 
create table t2bit (b1 bit(3), b2 bit(3));
851
 
insert into t1bit values (b'000', b'100');
852
 
insert into t1bit values (b'001', b'101');
853
 
insert into t1bit values (b'010', b'110');
854
 
insert into t2bit values (b'001', b'101');
855
 
insert into t2bit values (b'010', b'110');
856
 
insert into t2bit values (b'110', b'111');
857
 
set @@optimizer_switch=no_semijoin;
858
 
explain extended select bin(a1), bin(a2)
859
 
from t1bit
860
 
where (a1, a2) in (select b1, b2 from t2bit);
861
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
862
 
1       PRIMARY t1bit   ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
863
 
2       SUBQUERY        t2bit   ALL     NULL    NULL    NULL    NULL    3       100.00  
864
 
Warnings:
865
 
Note    1003    select conv("test"."t1bit"."a1",10,2) AS "bin(a1)",conv("test"."t1bit"."a2",10,2) AS "bin(a2)" from "test"."t1bit" where <in_optimizer>(("test"."t1bit"."a1","test"."t1bit"."a2"),("test"."t1bit"."a1","test"."t1bit"."a2") in ( <materialize> (select "test"."t2bit"."b1" AS "b1","test"."t2bit"."b2" AS "b2" from "test"."t2bit" ), <primary_index_lookup>("test"."t1bit"."a1" in <temporary table> on distinct_key)))
866
 
select bin(a1), bin(a2)
867
 
from t1bit
868
 
where (a1, a2) in (select b1, b2 from t2bit);
869
 
bin(a1) bin(a2)
870
 
1       101
871
 
10      110
872
 
drop table t1bit, t2bit;
873
 
create table t1bb (a1 bit(3), a2 blob(3));
874
 
create table t2bb (b1 bit(3), b2 blob(3));
875
 
insert into t1bb values (b'000', '100');
876
 
insert into t1bb values (b'001', '101');
877
 
insert into t1bb values (b'010', '110');
878
 
insert into t2bb values (b'001', '101');
879
 
insert into t2bb values (b'010', '110');
880
 
insert into t2bb values (b'110', '111');
881
 
explain extended select bin(a1), a2
882
 
from t1bb
883
 
where (a1, a2) in (select b1, b2 from t2bb);
884
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
885
 
1       PRIMARY t1bb    ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
886
 
2       DEPENDENT SUBQUERY      t2bb    ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
887
 
Warnings:
888
 
Note    1003    select conv("test"."t1bb"."a1",10,2) AS "bin(a1)","test"."t1bb"."a2" AS "a2" from "test"."t1bb" where <in_optimizer>(("test"."t1bb"."a1","test"."t1bb"."a2"),("test"."t1bb"."a1","test"."t1bb"."a2") in (select "test"."t2bb"."b1" AS "b1","test"."t2bb"."b2" AS "b2" from "test"."t2bb" where ((<cache>("test"."t1bb"."a1") = "test"."t2bb"."b1") and (<cache>("test"."t1bb"."a2") = "test"."t2bb"."b2"))))
889
 
select bin(a1), a2
890
 
from t1bb
891
 
where (a1, a2) in (select b1, b2 from t2bb);
892
 
bin(a1) a2
893
 
1       101
894
 
10      110
895
 
drop table t1bb, t2bb;
896
 
drop table t1, t2, t3, t1i, t2i, t3i, columns;
 
839
drop table t1, t2, t3;
897
840
/******************************************************************************
898
841
* Test the cache of the left operand of IN.
899
842
******************************************************************************/
933
876
1       PRIMARY t1      ALL     NULL    NULL    NULL    NULL    7       100.00  Using where
934
877
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    6       100.00  Using where
935
878
Warnings:
936
 
Note    1003    select "test"."t1"."a" AS "a" from "test"."t1" where <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)))
 
879
Note    1003    select `test`.`t1`.`a` AS `a` from `test`.`t1` where <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)))
937
880
select a from t1 where a in (select c from t2 where d >= 20);
938
881
a
939
882
2
947
890
1       PRIMARY t1      index   NULL    it1a    4       NULL    7       100.00  Using where; Using index
948
891
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    6       100.00  Using where
949
892
Warnings:
950
 
Note    1003    select "test"."t1"."a" AS "a" from "test"."t1" where <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)))
 
893
Note    1003    select `test`.`t1`.`a` AS `a` from `test`.`t1` where <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)))
951
894
select a from t1 where a in (select c from t2 where d >= 20);
952
895
a
953
896
2
961
904
1       PRIMARY t1      index   NULL    it1a    4       NULL    7       100.00  Using where; Using index
962
905
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    7       100.00  Using where
963
906
Warnings:
964
 
Note    1003    select "test"."t1"."a" AS "a" from "test"."t1" where <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)))
 
907
Note    1003    select `test`.`t1`.`a` AS `a` from `test`.`t1` where <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)))
965
908
select a from t1 where a in (select c from t2 where d >= 20);
966
909
a
967
910
2
971
914
explain extended
972
915
select a from t1 group by a having a in (select c from t2 where d >= 20);
973
916
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
974
 
1       PRIMARY t1      index   NULL    it1a    4       NULL    7       100.00  Using index
 
917
1       PRIMARY t1      range   NULL    it1a    4       NULL    3       100.00  Using index for group-by
975
918
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    7       100.00  Using where
976
919
Warnings:
977
 
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)))
 
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)))
978
921
select a from t1 group by a having a in (select c from t2 where d >= 20);
979
922
a
980
923
2
983
926
explain extended
984
927
select a from t1 group by a having a in (select c from t2 where d >= 20);
985
928
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
986
 
1       PRIMARY t1      index   NULL    it1a    4       NULL    7       100.00  Using index
 
929
1       PRIMARY t1      range   NULL    it1a    4       NULL    3       100.00  Using index for group-by
987
930
2       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    7       100.00  Using where
988
931
Warnings:
989
 
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)))
 
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)))
990
933
select a from t1 group by a having a in (select c from t2 where d >= 20);
991
934
a
992
935
2
995
938
select a from t1 group by a
996
939
having a in (select c from t2 where d >= some(select e from t3 where max(b)=e));
997
940
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
998
 
1       PRIMARY t1      index   NULL    iab     8       NULL    7       100.00  Using index
 
941
1       PRIMARY t1      range   NULL    iab     4       NULL    3       100.00  Using index for group-by
999
942
2       DEPENDENT SUBQUERY      t2      ALL     NULL    NULL    NULL    NULL    7       100.00  Using where
1000
943
3       DEPENDENT SUBQUERY      t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
1001
944
Warnings:
1002
945
Note    1276    Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
1003
 
Note    1003    select "test"."t1"."a" AS "a" from "test"."t1" group by "test"."t1"."a" having <in_optimizer>("test"."t1"."a",<exists>(select 1 AS "Not_used" from "test"."t2" where (<nop>(<in_optimizer>("test"."t2"."d",<exists>(select "test"."t3"."e" AS "e" from "test"."t3" where (max("test"."t1"."b") = "test"."t3"."e") having (<cache>("test"."t2"."d") >= <ref_null_helper>("test"."t3"."e"))))) and (<cache>("test"."t1"."a") = "test"."t2"."c"))))
 
946
Note    1003    select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` where (<nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` AS `e` from `test`.`t3` where (max(`test`.`t1`.`b`) = `test`.`t3`.`e`) having (<cache>(`test`.`t2`.`d`) >= <ref_null_helper>(`test`.`t3`.`e`))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`))))
1004
947
select a from t1 group by a
1005
948
having a in (select c from t2 where d >= some(select e from t3 where max(b)=e));
1006
949
a
1015
958
3       DEPENDENT SUBQUERY      t3      ALL     NULL    NULL    NULL    NULL    4       100.00  Using where
1016
959
Warnings:
1017
960
Note    1276    Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
1018
 
Note    1003    select "test"."t1"."a" AS "a" from "test"."t1" where <in_optimizer>("test"."t1"."a",<exists>(select 1 AS "Not_used" from "test"."t2" where (<nop>(<in_optimizer>("test"."t2"."d",<exists>(select 1 AS "Not_used" from "test"."t3" where (("test"."t1"."b" = "test"."t3"."e") and (<cache>("test"."t2"."d") >= "test"."t3"."e"))))) and (<cache>("test"."t1"."a") = "test"."t2"."c"))))
 
961
Note    1003    select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` where (<nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 AS `Not_used` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`))))
1019
962
select a from t1
1020
963
where a in (select c from t2 where d >= some(select e from t3 where b=e));
1021
964
a