217
217
update t1 set y=x;
218
218
explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0;
219
219
id select_type table type possible_keys key key_len ref rows Extra
220
1 SIMPLE t1 ref y y 5 const 1
220
1 SIMPLE t1 ref y y 5 const 1 Using where
221
221
1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer
222
222
explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0;
223
223
id select_type table type possible_keys key key_len ref rows Extra
224
1 SIMPLE t1 ref y y 5 const 1
224
1 SIMPLE t1 ref y y 5 const 1 Using where
225
225
1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer
226
226
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
227
227
id select_type table type possible_keys key key_len ref rows Extra
228
1 SIMPLE t1 ref y y 5 const 1
228
1 SIMPLE t1 ref y y 5 const 1 Using where
229
229
1 SIMPLE t2 range x x 5 NULL 3 Using where; Using join buffer
230
230
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
231
231
id select_type table type possible_keys key key_len ref rows Extra
232
1 SIMPLE t1 ref y y 5 const 1
232
1 SIMPLE t1 ref y y 5 const 1 Using where
233
233
1 SIMPLE t2 range x x 5 NULL 3 Using where; Using join buffer
234
234
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
235
235
id select_type table type possible_keys key key_len ref rows Extra
236
1 SIMPLE t1 ref y y 5 const 1
236
1 SIMPLE t1 ref y y 5 const 1 Using where
237
237
1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer
238
238
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
239
239
id select_type table type possible_keys key key_len ref rows Extra
240
1 SIMPLE t1 ref y y 5 const 1
240
1 SIMPLE t1 ref y y 5 const 1 Using where
241
241
1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer
242
242
explain select count(*) from t1 where x in (1);
243
243
id select_type table type possible_keys key key_len ref rows Extra
244
1 SIMPLE t1 ref x x 5 const 1 Using index
244
1 SIMPLE t1 ref x x 5 const 1 Using where; Using index
245
245
explain select count(*) from t1 where x in (1,2);
246
246
id select_type table type possible_keys key key_len ref rows Extra
247
247
1 SIMPLE t1 index x x 5 NULL 9 Using where; Using index