27
alter table t1 add c int DEFAULT 42 not null, add key using HASH (c,a);
27
alter table t1 add c int not null, add key using HASH (c,a);
29
29
create temporary table t1 (a int not null,b int not null, primary key using HASH (a)) engine=MEMORY comment="testing heaps";
30
30
insert into t1 values(1,1),(2,2),(3,3),(4,4);
160
160
1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
161
161
select * from t1 where btn like "q%";
163
alter table t1 add column new_col char(1) default "Y" not null, add key using HASH (btn,new_col), drop key btn;
163
alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn;
164
164
update t1 set new_col=left(btn,1);
165
165
explain select * from t1 where btn="a";
166
166
id select_type table type possible_keys key key_len ref rows Extra
290
290
insert into t2 select * from t1;
291
291
explain select * from t1 where name='matt';
292
292
id select_type table type possible_keys key key_len ref rows Extra
293
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 82 const 2 Using where
293
1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 82 const 1 Using where
294
294
explain select * from t2 where name='matt';
295
295
id select_type table type possible_keys key key_len ref rows Extra
296
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 82 const 2 Using where
296
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 82 const 1 Using where
297
297
explain select * from t1 where name='Lilu';
298
298
id select_type table type possible_keys key key_len ref rows Extra
299
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 82 const 2 Using where
299
1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 82 const 1 Using where
300
300
explain select * from t2 where name='Lilu';
301
301
id select_type table type possible_keys key key_len ref rows Extra
302
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 82 const 2 Using where
302
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 82 const 1 Using where
303
303
explain select * from t1 where name='Phil';
304
304
id select_type table type possible_keys key key_len ref rows Extra
305
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 82 const 2 Using where
305
1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 82 const 1 Using where
306
306
explain select * from t2 where name='Phil';
307
307
id select_type table type possible_keys key key_len ref rows Extra
308
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 82 const 2 Using where
308
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 82 const 1 Using where
309
309
explain select * from t1 where name='Lilu';
310
310
id select_type table type possible_keys key key_len ref rows Extra
311
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 82 const 2 Using where
311
1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 82 const 1 Using where
312
312
explain select * from t2 where name='Lilu';
313
313
id select_type table type possible_keys key key_len ref rows Extra
314
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 82 const 2 Using where
314
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 82 const 1 Using where
315
315
insert into t1 (name) select name from t2;
316
316
insert into t1 (name) select name from t2;
317
317
insert into t1 (name) select name from t2;