~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/heap_btree.result

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-13 01:03:01 UTC
  • mto: (1126.9.2 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090913010301-tcvvezipx1124acy
Added calls to the dtrace delete begin/end probes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1;
2
 
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=MEMORY comment="testing heaps";
 
2
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
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
 
show table status like "t1";
6
 
Session Schema  Name    Type    Engine  Version Rows    Avg_row_length  Table_size      Auto_increment
7
 
#       test    t1      TEMPORARY       MEMORY  #       #       #       #       #
8
5
show keys from t1;
9
 
Table   Unique  Key_name        Seq_in_index    Column_name
10
 
t1      TRUE    PRIMARY 1       a
 
6
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
7
t1      0       PRIMARY 1       a       A       NULL    NULL    NULL            BTREE           
11
8
select * from t1;
12
9
a       b
13
10
2       2
26
23
4       6
27
24
alter table t1 add c int not null, add key using BTREE (c,a);
28
25
drop table t1;
29
 
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=MEMORY 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";
30
27
insert into t1 values(-2,-2),(-1,-1),(0,0),(1,1),(2,2),(3,3),(4,4);
31
28
delete from t1 where a > -3;
32
29
select * from t1;
33
30
a       b
34
31
drop table t1;
35
 
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=MEMORY 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";
36
33
insert into t1 values(1,1),(2,2),(3,3),(4,4);
37
34
alter table t1 modify a int not null auto_increment, engine=innodb, comment="new innodb table";
38
 
show table status like "t1";
39
 
Session Schema  Name    Type    Engine  Version Rows    Avg_row_length  Table_size      Auto_increment
40
 
#       test    t1      TEMPORARY       InnoDB  #       #       #       #       #
41
35
select * from t1;
42
36
a       b
43
37
1       1
45
39
3       3
46
40
4       4
47
41
drop table t1;
48
 
create temporary table t1 (a int not null) engine=MEMORY;
 
42
create temporary table t1 (a int not null) engine=heap;
49
43
insert into t1 values (869751),(736494),(226312),(802616),(728912);
50
44
select * from t1 where a > 736494;
51
45
a
75
69
1       SIMPLE  t1      index   uniq_id uniq_id 4       NULL    5       Using where; Using index
76
70
drop table t1;
77
71
create temporary table t1 (x int not null, y int not null, key x  using BTREE (x,y), unique y  using BTREE (y))
78
 
engine=MEMORY;
 
72
engine=heap;
79
73
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
80
74
explain select * from t1 where x=1;
81
75
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
89
83
explain select * from t1,t1 as t2 where t1.x=t2.y;
90
84
ERROR HY000: Can't reopen table: 't1'
91
85
drop table t1;
92
 
create temporary table t1 (a int) engine=MEMORY;
 
86
create temporary table t1 (a int) engine=heap;
93
87
insert into t1 values(1);
94
88
select max(a) from t1;
95
89
max(a)
96
90
1
97
91
drop table t1;
98
 
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;
 
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;
99
93
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
100
94
select * from t1 where a=1;
101
95
a       b
134
128
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
135
129
x       SIMPLE  tx      ref     b       b       x       const   x       
136
130
drop table t1;
137
 
create temporary table t1 (id int not null, primary key  using BTREE (id)) engine=MEMORY;
 
131
create temporary table t1 (id int not null, primary key  using BTREE (id)) engine=HEAP;
138
132
insert into t1 values(1);
139
133
select max(id) from t1;
140
134
max(id)
145
139
2
146
140
replace into t1 values(1);
147
141
drop table t1;
148
 
create temporary table t1 (n int) engine=MEMORY;
 
142
create temporary table t1 (n int) engine=heap;
149
143
drop table t1;
150
 
create temporary table t1 (n int) engine=MEMORY;
 
144
create temporary table t1 (n int) engine=heap;
151
145
drop table if exists t1;
152
146
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not 
153
 
null,index(f2)) engine=MEMORY;
 
147
null,index(f2)) engine=heap;
154
148
INSERT into t1 set f1=12,f2="bill";
155
149
INSERT into t1 set f1=13,f2="bill";
156
150
INSERT into t1 set f1=14,f2="bill";
169
163
12      ted
170
164
12      ted
171
165
drop table t1;
172
 
create temporary table t1 (btn char(10) not null, key using BTREE (btn)) engine=MEMORY;
 
166
create temporary table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
173
167
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
174
168
explain select * from t1 where btn like "i%";
175
169
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
203
197
b int default NULL,
204
198
KEY a using BTREE (a),
205
199
UNIQUE b using BTREE (b)
206
 
) engine=MEMORY;
 
200
) engine=heap;
207
201
INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
208
202
SELECT * FROM t1 WHERE a=NULL;
209
203
a       b
224
218
INSERT INTO t1 VALUES (1,3);
225
219
ERROR 23000: Duplicate entry '3' for key 'b'
226
220
DROP TABLE t1;
227
 
CREATE TEMPORARY TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=MEMORY;
 
221
CREATE TEMPORARY TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;
228
222
INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1);
229
223
SELECT * FROM t1 WHERE a=1 and b IS NULL;
230
224
a       b       c
238
232
a       b       c
239
233
1       NULL    NULL
240
234
DROP TABLE t1;
241
 
CREATE TEMPORARY TABLE t1 (a int not null, primary key using BTREE (a)) engine=MEMORY;
 
235
CREATE TEMPORARY TABLE t1 (a int not null, primary key using BTREE (a)) engine=heap;
242
236
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
243
237
DELETE from t1 where a < 100;
244
238
SELECT * from t1;
245
239
a
246
240
DROP TABLE t1;
247
 
create temporary table t1(a int not null, key using btree(a)) engine=MEMORY;
 
241
create temporary table t1(a int not null, key using btree(a)) engine=heap;
248
242
insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
249
243
select a from t1 where a > 2 order by a;
250
244
a
307
301
1
308
302
DROP TABLE t1;
309
303
End of 4.1 tests
 
304
CREATE TEMPORARY TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
 
305
INSERT INTO t1 VALUES(0);
 
306
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
 
307
INDEX_LENGTH
 
308
UPDATE t1 SET val=1;
 
309
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
 
310
INDEX_LENGTH
 
311
DROP TABLE t1;
310
312
CREATE TEMPORARY TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
311
313
INSERT INTO t1 VALUES(NULL),(NULL);
312
314
DROP TABLE t1;