~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/heap_hash.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,t2;
2
 
create temporary table t1 (a int not null,b int not null, primary key using HASH (a)) engine=MEMORY comment="testing heaps";
 
2
create temporary table t1 (a int not null,b int not null, primary key using HASH (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       NULL    3       NULL    NULL            HASH            
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 HASH (c,a);
28
25
drop table t1;
29
 
create temporary table t1 (a int not null,b int not null, primary key using HASH (a)) engine=MEMORY 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";
30
27
insert into t1 values(1,1),(2,2),(3,3),(4,4);
31
28
delete from t1 where a > 0;
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 HASH (a)) engine=MEMORY 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";
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 HASH (x), unique y  using HASH (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
select * from t1 where x=1;
81
75
x       y
86
80
explain select * from t1,t1 as t2 where t1.x=t2.y;
87
81
ERROR HY000: Can't reopen table: 't1'
88
82
drop table t1;
89
 
create temporary table t1 (a int) engine=MEMORY;
 
83
create temporary table t1 (a int) engine=heap;
90
84
insert into t1 values(1);
91
85
select max(a) from t1;
92
86
max(a)
93
87
1
94
88
drop table t1;
95
 
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=MEMORY;
 
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;
96
90
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
97
91
select * from t1 where a=1;
98
92
a       b
118
112
1       2
119
113
1       1
120
114
drop table t1;
121
 
create temporary table t1 (id int not null, primary key  using HASH (id)) engine=MEMORY;
 
115
create temporary table t1 (id int not null, primary key  using HASH (id)) engine=HEAP;
122
116
insert into t1 values(1);
123
117
select max(id) from t1;
124
118
max(id)
129
123
2
130
124
replace into t1 values(1);
131
125
drop table t1;
132
 
create temporary table t1 (n int) engine=MEMORY;
 
126
create temporary table t1 (n int) engine=heap;
133
127
drop table t1;
134
 
create temporary table t1 (n int) engine=MEMORY;
 
128
create temporary table t1 (n int) engine=heap;
135
129
drop table if exists t1;
136
130
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not 
137
 
null,index(f2)) engine=MEMORY;
 
131
null,index(f2)) engine=heap;
138
132
INSERT into t1 set f1=12,f2="bill";
139
133
INSERT into t1 set f1=13,f2="bill";
140
134
INSERT into t1 set f1=14,f2="bill";
153
147
12      ted
154
148
12      ted
155
149
drop table t1;
156
 
create temporary table t1 (btn char(10) not null, key using HASH (btn)) engine=MEMORY;
 
150
create temporary table t1 (btn char(10) not null, key using HASH (btn)) engine=heap;
157
151
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
158
152
explain select * from t1 where btn like "q%";
159
153
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
174
168
b int default NULL,
175
169
KEY a using HASH (a),
176
170
UNIQUE b using HASH (b)
177
 
) engine=MEMORY;
 
171
) engine=heap;
178
172
INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
179
173
SELECT * FROM t1 WHERE a=NULL;
180
174
a       b
195
189
INSERT INTO t1 VALUES (1,3);
196
190
ERROR 23000: Duplicate entry '3' for key 'b'
197
191
DROP TABLE t1;
198
 
CREATE TEMPORARY TABLE t1 (a int not null, primary key using HASH (a)) engine=MEMORY;
 
192
CREATE TEMPORARY TABLE t1 (a int not null, primary key using HASH (a)) engine=heap;
199
193
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
200
194
DELETE from t1 where a < 100;
201
195
SELECT * from t1;
207
201
b char(20) not null,
208
202
c int not null,
209
203
key (a)
210
 
) engine=MEMORY;
 
204
) engine=heap;
211
205
insert into t1 values ('aaaa', 'prefill-hash=5',0);
212
206
insert into t1 values ('aaab', 'prefill-hash=0',0);
213
207
insert into t1 values ('aaac', 'prefill-hash=7',0);
277
271
name varchar(20) not null,
278
272
index heap_idx(name),
279
273
index btree_idx using btree(name)
280
 
) engine=MEMORY;
 
274
) engine=heap;
281
275
create temporary table t2 (
282
276
id int not null primary key auto_increment, 
283
277
name varchar(20) not null,
284
278
index btree_idx using btree(name),
285
279
index heap_idx(name)
286
 
) engine=MEMORY;
 
280
) engine=heap;
287
281
insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'), 
288
282
('Suzy'), ('Hoppy'), ('Burrito'), ('Mimi'), ('Sherry'), ('Ben'), ('Phil'), 
289
283
('Emily'), ('Mike');
326
320
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
327
321
1       SIMPLE  t1      ref     heap_idx        heap_idx        82      const   9       Using where
328
322
show index from t1;
329
 
Table   Unique  Key_name        Seq_in_index    Column_name
330
 
t1      TRUE    PRIMARY 1       id
331
 
t1      FALSE   heap_idx        1       name
332
 
t1      FALSE   btree_idx       1       name
 
323
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
324
t1      0       PRIMARY 1       id      NULL    91      NULL    NULL            HASH            
 
325
t1      1       heap_idx        1       name    NULL    10      NULL    NULL            HASH            
 
326
t1      1       btree_idx       1       name    A       NULL    NULL    NULL            BTREE           
333
327
show index from t1;
334
 
Table   Unique  Key_name        Seq_in_index    Column_name
335
 
t1      TRUE    PRIMARY 1       id
336
 
t1      FALSE   heap_idx        1       name
337
 
t1      FALSE   btree_idx       1       name
 
328
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
329
t1      0       PRIMARY 1       id      NULL    91      NULL    NULL            HASH            
 
330
t1      1       heap_idx        1       name    NULL    10      NULL    NULL            HASH            
 
331
t1      1       btree_idx       1       name    A       NULL    NULL    NULL            BTREE           
338
332
create temporary table t3
339
333
(
340
334
a varchar(20) not null,
341
335
b varchar(20) not null,
342
336
key (a,b)
343
 
) engine=MEMORY;
 
337
) engine=heap;
344
338
insert into t3 select name, name from t1;
345
339
show index from t3;
346
 
Table   Unique  Key_name        Seq_in_index    Column_name
347
 
t3      FALSE   a       1       a
348
 
t3      FALSE   a       2       b
 
340
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
341
t3      1       a       1       a       NULL    NULL    NULL    NULL            HASH            
 
342
t3      1       a       2       b       NULL    13      NULL    NULL            HASH            
349
343
show index from t3;
350
 
Table   Unique  Key_name        Seq_in_index    Column_name
351
 
t3      FALSE   a       1       a
352
 
t3      FALSE   a       2       b
 
344
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
345
t3      1       a       1       a       NULL    NULL    NULL    NULL            HASH            
 
346
t3      1       a       2       b       NULL    13      NULL    NULL            HASH            
353
347
explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
354
348
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
355
349
1       SIMPLE  t1      ref     heap_idx        heap_idx        82      const   9       Using where
356
350
1       SIMPLE  t3      ref     a       a       164     func,const      7       Using where
357
351
drop table t1, t2, t3;
358
 
create temporary table t1 ( a int, index (a) ) engine=memory;
 
352
create temporary temporary table t1 ( a int, index (a) ) engine=memory;
359
353
insert into t1 values (1),(2),(3),(4),(5);
360
354
select a from t1 where a in (1,3);
361
355
a