1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
drop table if exists t1;
set @@session.max_heap_table_size=16*1024*1024;
create table t1 (a int not null, b varchar(400), c int, primary key (a), key (c)) engine=heap comment="testing heaps" block_size=128;
ERROR 42000: Incorrect usage/placement of 'block_size'
create table t1 (a int not null, b int, c varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" block_size=4;
ERROR 42000: Incorrect usage/placement of 'block_size'
create table t1 (a int not null, b int, c varchar(400), d varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" block_size=24;
insert into t1 values (1,1,'012',NULL), (2,2,'0123456789',NULL), (3,3,'012345678901234567890123456789',NULL), (4,4,NULL,'0123456789012345678901234567890123456789012345678901234567890123456789');
select * from t1;
a b c d
1 1 012 NULL
2 2 0123456789 NULL
3 3 012345678901234567890123456789 NULL
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
delete from t1 where a = 3;
select * from t1;
a b c d
1 1 012 NULL
2 2 0123456789 NULL
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
insert into t1 values (5,5,NULL,'0123'), (6,6,NULL,'0123');
select * from t1;
a b c d
1 1 012 NULL
2 2 0123456789 NULL
6 6 NULL 0123
5 5 NULL 0123
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
update t1 set c = '012345678901234567890123456789' where a = 2;
select * from t1;
a b c d
1 1 012 NULL
2 2 012345678901234567890123456789 NULL
6 6 NULL 0123
5 5 NULL 0123
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
update t1 set c = '0123456789' where a = 2;
select * from t1;
a b c d
1 1 012 NULL
2 2 0123456789 NULL
6 6 NULL 0123
5 5 NULL 0123
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
insert into t1 values (7,7,'0123',NULL), (8,8,'0123',NULL);
select * from t1;
a b c d
1 1 012 NULL
2 2 0123456789 NULL
6 6 NULL 0123
5 5 NULL 0123
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
7 7 0123 NULL
8 8 0123 NULL
alter table t1 block_size = 0;
alter table t1 row_format = dynamic;
alter table t1 block_size = 128, max_rows = 10001;
select * from t1;
a b c d
1 1 012 NULL
2 2 0123456789 NULL
6 6 NULL 0123
5 5 NULL 0123
4 4 NULL 0123456789012345678901234567890123456789012345678901234567890123456789
7 7 0123 NULL
8 8 0123 NULL
delete from t1;
select * from t1;
a b c d
select count(*) from t1;
count(*)
10001
insert into t1 values (100000,100000,NULL,'0123'), (100000,100000,NULL,'0123');
ERROR HY000: The table 't1' is full
select count(*) from t1;
count(*)
10001
set @@session.max_heap_table_size=default;
drop table t1;
|