1
1
drop table if exists t1,t2;
2
create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
2
create temporary table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
3
3
insert into t1 values(1,1),(2,2),(3,3),(4,4);
4
4
delete from t1 where a=1 or a=0;
24
24
alter table t1 add c int not null, add key using HASH (c,a);
26
create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps";
26
create temporary table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps";
27
27
insert into t1 values(1,1),(2,2),(3,3),(4,4);
28
28
delete from t1 where a > 0;
32
create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps";
32
create temporary table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps";
33
33
insert into t1 values(1,1),(2,2),(3,3),(4,4);
34
34
alter table t1 modify a int not null auto_increment, engine=innodb, comment="new innodb table";
68
68
id select_type table type possible_keys key key_len ref rows Extra
69
69
1 SIMPLE t1 index uniq_id uniq_id 4 NULL 5 Using where; Using index
71
create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y))
71
create temporary table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y))
73
73
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
74
74
select * from t1 where x=1;
78
78
select * from t1,t1 as t2 where t1.x=t2.y;
79
ERROR HY000: Can't reopen table: 't1'
86
80
explain select * from t1,t1 as t2 where t1.x=t2.y;
87
id select_type table type possible_keys key key_len ref rows Extra
88
1 SIMPLE t1 ALL x NULL NULL NULL 6
89
1 SIMPLE t2 eq_ref y y 4 test.t1.x 1
81
ERROR HY000: Can't reopen table: 't1'
91
create table t1 (a int) engine=heap;
83
create temporary table t1 (a int) engine=heap;
92
84
insert into t1 values(1);
93
85
select max(a) from t1;
97
CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using HASH (a), key using HASH (b) ) ENGINE=HEAP;
89
CREATE TEMPORARY TABLE t1 ( a int not null default 0, b int not null default 0, key using HASH (a), key using HASH (b) ) ENGINE=HEAP;
98
90
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
99
91
select * from t1 where a=1;
132
124
replace into t1 values(1);
134
create table t1 (n int) engine=heap;
126
create temporary table t1 (n int) engine=heap;
136
create table t1 (n int) engine=heap;
128
create temporary table t1 (n int) engine=heap;
137
129
drop table if exists t1;
138
CREATE table t1(f1 int not null,f2 char(20) not
130
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not
139
131
null,index(f2)) engine=heap;
140
132
INSERT into t1 set f1=12,f2="bill";
141
133
INSERT into t1 set f1=13,f2="bill";
158
create table t1 (btn char(10) not null, key using HASH (btn)) engine=heap;
150
create temporary table t1 (btn char(10) not null, key using HASH (btn)) engine=heap;
159
151
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
160
152
explain select * from t1 where btn like "q%";
161
153
id select_type table type possible_keys key key_len ref rows Extra
197
189
INSERT INTO t1 VALUES (1,3);
198
190
ERROR 23000: Duplicate entry '3' for key 'b'
200
CREATE TABLE t1 (a int not null, primary key using HASH (a)) engine=heap;
192
CREATE TEMPORARY TABLE t1 (a int not null, primary key using HASH (a)) engine=heap;
201
193
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
202
194
DELETE from t1 where a < 100;
203
195
SELECT * from t1;
198
create temporary table t1
208
200
a char(8) not null,
209
201
b char(20) not null,
231
223
id select_type table type possible_keys key key_len ref rows Extra
232
224
1 SIMPLE t1 ref a a 34 const 2 Using where
233
225
insert into t1 select * from t1;
235
explain select * from t1 where a='aaaa';
236
id select_type table type possible_keys key key_len ref rows Extra
237
1 SIMPLE t1 ref a a 34 const 2 Using where
238
explain select * from t1 where a='aaab';
239
id select_type table type possible_keys key key_len ref rows Extra
240
1 SIMPLE t1 ref a a 34 const 2 Using where
241
explain select * from t1 where a='aaac';
242
id select_type table type possible_keys key key_len ref rows Extra
243
1 SIMPLE t1 ref a a 34 const 2 Using where
244
explain select * from t1 where a='aaad';
245
id select_type table type possible_keys key key_len ref rows Extra
246
1 SIMPLE t1 ref a a 34 const 2 Using where
248
explain select * from t1 where a='aaaa';
249
id select_type table type possible_keys key key_len ref rows Extra
250
1 SIMPLE t1 ref a a 34 const 2 Using where
251
explain select * from t1 where a='aaab';
252
id select_type table type possible_keys key key_len ref rows Extra
253
1 SIMPLE t1 ref a a 34 const 2 Using where
254
explain select * from t1 where a='aaac';
255
id select_type table type possible_keys key key_len ref rows Extra
256
1 SIMPLE t1 ref a a 34 const 2 Using where
257
explain select * from t1 where a='aaad';
258
id select_type table type possible_keys key key_len ref rows Extra
259
1 SIMPLE t1 ref a a 34 const 2 Using where
260
create table t2 as select * from t1;
226
ERROR HY000: Can't reopen table: 't1'
228
explain select * from t1 where a='aaaa';
229
id select_type table type possible_keys key key_len ref rows Extra
230
1 SIMPLE t1 ref a a 34 const 2 Using where
231
explain select * from t1 where a='aaab';
232
id select_type table type possible_keys key key_len ref rows Extra
233
1 SIMPLE t1 ref a a 34 const 2 Using where
234
explain select * from t1 where a='aaac';
235
id select_type table type possible_keys key key_len ref rows Extra
236
1 SIMPLE t1 ref a a 34 const 2 Using where
237
explain select * from t1 where a='aaad';
238
id select_type table type possible_keys key key_len ref rows Extra
239
1 SIMPLE t1 ref a a 34 const 2 Using where
241
explain select * from t1 where a='aaaa';
242
id select_type table type possible_keys key key_len ref rows Extra
243
1 SIMPLE t1 ref a a 34 const 2 Using where
244
explain select * from t1 where a='aaab';
245
id select_type table type possible_keys key key_len ref rows Extra
246
1 SIMPLE t1 ref a a 34 const 2 Using where
247
explain select * from t1 where a='aaac';
248
id select_type table type possible_keys key key_len ref rows Extra
249
1 SIMPLE t1 ref a a 34 const 2 Using where
250
explain select * from t1 where a='aaad';
251
id select_type table type possible_keys key key_len ref rows Extra
252
1 SIMPLE t1 ref a a 34 const 2 Using where
253
create temporary table t2 as select * from t1;
262
255
insert into t1 select * from t2;
263
256
explain select * from t1 where a='aaaa';
273
266
id select_type table type possible_keys key key_len ref rows Extra
274
267
1 SIMPLE t1 ref a a 34 const 2 Using where
275
268
drop table t1, t2;
269
create temporary table t1 (
277
270
id int not null primary key auto_increment,
278
271
name varchar(20) not null,
279
272
index heap_idx(name),
280
273
index btree_idx using btree(name)
275
create temporary table t2 (
283
276
id int not null primary key auto_increment,
284
277
name varchar(20) not null,
285
278
index btree_idx using btree(name),
356
349
1 SIMPLE t1 ref heap_idx heap_idx 82 const 9 Using where
357
350
1 SIMPLE t3 ref a a 164 func,const 7 Using where
358
351
drop table t1, t2, t3;
359
create temporary table t1 ( a int, index (a) ) engine=memory;
352
create temporary temporary table t1 ( a int, index (a) ) engine=memory;
360
353
insert into t1 values (1),(2),(3),(4),(5);
361
354
select a from t1 where a in (1,3);
367
360
1 SIMPLE t1 range a a 5 NULL 4 Using where
370
CREATE TABLE t1(col1 VARCHAR(32) COLLATE utf8_bin NOT NULL,
363
CREATE TEMPORARY TABLE t1(col1 VARCHAR(32) COLLATE utf8_bin NOT NULL,
371
364
col2 VARCHAR(32) COLLATE utf8_bin NOT NULL,
372
365
UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY;
373
366
INSERT INTO t1 VALUES('A', 'A');
374
367
INSERT INTO t1 VALUES('A ', 'A ');
375
368
ERROR 23000: Duplicate entry 'A -A ' for key 'key1'
377
CREATE TABLE t1(col1 VARCHAR(32) COLLATE utf8_bin NOT NULL,
370
CREATE TEMPORARY TABLE t1(col1 VARCHAR(32) COLLATE utf8_bin NOT NULL,
378
371
col2 VARCHAR(32) COLLATE utf8_bin NOT NULL,
379
372
UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY;
380
373
INSERT INTO t1 VALUES('A', 'A');