create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=MEMORY comment="testing heaps";
9
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;
10
10
insert into t1 values(1,1),(2,2),(3,3),(4,4);
11
11
delete from t1 where a=1 or a=0;
12
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
13
show table status like "t1";
12
#show table status like "t1";
14
13
show keys from t1;
15
14
select * from t1;
16
15
select * from t1 where a=4;
21
20
alter table t1 add c int not null, add key using BTREE (c,a);
22
21
drop table t1;
23
22
24
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=MEMORY comment="testing heaps";
23
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
25
24
insert into t1 values(-2,-2),(-1,-1),(0,0),(1,1),(2,2),(3,3),(4,4);
26
25
delete from t1 where a > -3;
27
26
select * from t1;
28
27
drop table t1;
29
28
30
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=MEMORY comment="testing heaps";
29
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
31
30
insert into t1 values(1,1),(2,2),(3,3),(4,4);
32
31
alter table t1 modify a int not null auto_increment, engine=innodb, comment="new innodb table";
33
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
34
show table status like "t1";
32
#show table status like "t1";
35
33
select * from t1;
36
34
drop table t1;
37
35
38
create temporary table t1 (a int not null) engine=MEMORY;
36
create temporary table t1 (a int not null) engine=heap;
39
37
insert into t1 values (869751),(736494),(226312),(802616),(728912);
40
38
select * from t1 where a > 736494;
41
39
alter table t1 add unique uniq_id using BTREE (a);
48
46
drop table t1;
49
47
50
48
create temporary table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y))
51
engine=MEMORY;
49
engine=heap;
52
50
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
53
51
explain select * from t1 where x=1;
54
52
select * from t1 where x=1;
58
56
explain select * from t1,t1 as t2 where t1.x=t2.y;
59
57
drop table t1;
60
58
61
create temporary table t1 (a int) engine=MEMORY;
59
create temporary table t1 (a int) engine=heap;
62
60
insert into t1 values(1);
63
61
select max(a) from t1;
64
62
drop table t1;
65
63
66
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=MEMORY;
64
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;
67
65
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
68
66
select * from t1 where a=1;
69
67
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
77
75
explain select * from t1 where b=1;
78
76
drop table t1;
79
77
80
create temporary table t1 (id int not null, primary key using BTREE (id)) engine=MEMORY;
78
create temporary table t1 (id int not null, primary key using BTREE (id)) engine=HEAP;
81
79
insert into t1 values(1);
82
80
select max(id) from t1;
83
81
insert into t1 values(2);
85
83
replace into t1 values(1);
86
84
drop table t1;
87
85
88
create temporary table t1 (n int) engine=MEMORY;
86
create temporary table t1 (n int) engine=heap;
89
87
drop table t1;
90
88
91
create temporary table t1 (n int) engine=MEMORY;
89
create temporary table t1 (n int) engine=heap;
92
90
drop table if exists t1;
93
91
94
92
# Test of non unique index
95
93
96
94
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not
97
null,index(f2)) engine=MEMORY;
95
null,index(f2)) engine=heap;
98
96
INSERT into t1 set f1=12,f2="bill";
99
97
INSERT into t1 set f1=13,f2="bill";
100
98
INSERT into t1 set f1=14,f2="bill";
112
110
# Test when using part key searches
113
111
#
114
112
115
create temporary table t1 (btn char(10) not null, key using BTREE (btn)) engine=MEMORY;
113
create temporary table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
116
114
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
117
115
explain select * from t1 where btn like "i%";
118
116
--replace_column 9 #
138
136
b int default NULL,
139
137
KEY a using BTREE (a),
140
138
UNIQUE b using BTREE (b)
141
) engine=MEMORY;
139
) engine=heap;
142
140
INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
143
141
SELECT * FROM t1 WHERE a=NULL;
144
142
explain SELECT * FROM t1 WHERE a IS NULL;
151
149
INSERT INTO t1 VALUES (1,3);
152
150
DROP TABLE t1;
153
151
154
CREATE TEMPORARY TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=MEMORY;
152
CREATE TEMPORARY TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;