create table t1 (a int not null,b int not null, primary key using BTREE (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 BTREE (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;
5
5
show keys from t1;
23
23
4 6
24
24
alter table t1 add c int not null, add key using BTREE (c,a);
25
25
drop table t1;
26
create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
26
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
27
27
insert into t1 values(-2,-2),(-1,-1),(0,0),(1,1),(2,2),(3,3),(4,4);
28
28
delete from t1 where a > -3;
29
29
select * from t1;
30
30
a b
31
31
drop table t1;
32
create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
32
create temporary table t1 (a int not null,b int not null, primary key using BTREE (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";
35
35
select * from t1;
39
39
3 3
40
40
4 4
41
41
drop table t1;
42
create table t1 (a int not null) engine=heap;
42
create temporary table t1 (a int not null) engine=heap;
43
43
insert into t1 values (869751),(736494),(226312),(802616),(728912);
44
44
select * from t1 where a > 736494;
45
45
a
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
70
70
drop table t1;
71
create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y))
71
create temporary table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y))
72
72
engine=heap;
73
73
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
74
74
explain select * from t1 where x=1;
79
79
1 1
80
80
1 3
81
81
select * from t1,t1 as t2 where t1.x=t2.y;
82
x y x y
83
1 1 1 1
84
2 2 2 2
85
1 3 1 1
86
2 4 2 2
87
2 5 2 2
88
2 6 2 2
82
ERROR HY000: Can't reopen table: 't1'
89
83
explain select * from t1,t1 as t2 where t1.x=t2.y;
90
id select_type table type possible_keys key key_len ref rows Extra
91
1 SIMPLE t1 ALL x NULL NULL NULL 6
92
1 SIMPLE t2 eq_ref y y 4 test.t1.x 1
84
ERROR HY000: Can't reopen table: 't1'
93
85
drop table t1;
94
create table t1 (a int) engine=heap;
86
create temporary table t1 (a int) engine=heap;
95
87
insert into t1 values(1);
96
88
select max(a) from t1;
97
89
max(a)
98
90
1
99
91
drop table t1;
100
CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using BTREE (a,b), key using BTREE (b) ) ENGINE=HEAP;
92
CREATE TEMPORARY TABLE t1 ( a int not null default 0, b int not null default 0, key using BTREE (a,b), key using BTREE (b) ) ENGINE=HEAP;
101
93
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
102
94
select * from t1 where a=1;
103
95
a b
136
128
id select_type table type possible_keys key key_len ref rows Extra
137
129
x SIMPLE tx ref b b x const x
138
130
drop table t1;
139
create table t1 (id int not null, primary key using BTREE (id)) engine=HEAP;
131
create temporary table t1 (id int not null, primary key using BTREE (id)) engine=HEAP;
140
132
insert into t1 values(1);
141
133
select max(id) from t1;
142
134
max(id)
147
139
2
148
140
replace into t1 values(1);
149
141
drop table t1;
150
create table t1 (n int) engine=heap;
142
create temporary table t1 (n int) engine=heap;
151
143
drop table t1;
152
create table t1 (n int) engine=heap;
144
create temporary table t1 (n int) engine=heap;
153
145
drop table if exists t1;
154
CREATE table t1(f1 int not null,f2 char(20) not
146
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not
155
147
null,index(f2)) engine=heap;
156
148
INSERT into t1 set f1=12,f2="bill";
157
149
INSERT into t1 set f1=13,f2="bill";
171
163
12 ted
172
164
12 ted
173
165
drop table t1;
174
create table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
166
create temporary table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
175
167
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
176
168
explain select * from t1 where btn like "i%";
177
169
id select_type table type possible_keys key key_len ref rows Extra
200
192
id select_type table type possible_keys key key_len ref rows Extra
201
193
1 SIMPLE t1 ref btn btn 48 const,const 1 Using where
202
194
drop table t1;
203
CREATE TABLE t1 (
195
CREATE TEMPORARY TABLE t1 (
204
196
a int default NULL,
205
197
b int default NULL,
206
198
KEY a using BTREE (a),
226
218
INSERT INTO t1 VALUES (1,3);
227
219
ERROR 23000: Duplicate entry '3' for key 'b'
228
220
DROP TABLE t1;
229
CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;
221
CREATE TEMPORARY TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;