| 1 |
use test; |
| 2 |
create temporary table t1 |
| 3 |
(i int, b mediumblob, |
| 4 |
primary key pk(i), index sk(b(100)) |
| 5 |
) engine=innodb; |
| 6 |
create procedure populate_t1() |
| 7 |
begin |
| 8 |
declare i int default 1; |
| 9 |
while (i <= 100) do |
| 10 |
insert into t1 values (i, repeat(i,1000)); |
| 11 |
set i = i + 1; |
| 12 |
end while; |
| 13 |
end| |
| 14 |
create procedure populate_t1_small() |
| 15 |
begin |
| 16 |
declare i int default 1; |
| 17 |
while (i <= 8) do |
| 18 |
insert into t1 values (i, repeat(i,1000)); |
| 19 |
set i = i + 1; |
| 20 |
end while; |
| 21 |
end| |
| 22 |
begin; |
| 23 |
select count(*) from t1; |
| 24 |
count(*) |
| 25 |
0 |
| 26 |
call populate_t1(); |
| 27 |
select count(*) from t1; |
| 28 |
count(*) |
| 29 |
100 |
| 30 |
delete from t1 where i < 10; |
| 31 |
select count(*) from t1; |
| 32 |
count(*) |
| 33 |
91 |
| 34 |
commit; |
| 35 |
set global innodb_purge_stop_now=ON; |
| 36 |
set global innodb_purge_run_now=ON; |
| 37 |
delete from t1 where i < 20; |
| 38 |
select count(*) from t1; |
| 39 |
count(*) |
| 40 |
81 |
| 41 |
begin; |
| 42 |
call populate_t1_small(); |
| 43 |
select count(*) from t1; |
| 44 |
count(*) |
| 45 |
89 |
| 46 |
rollback; |
| 47 |
select count(*) from t1; |
| 48 |
count(*) |
| 49 |
81 |
| 50 |
begin; |
| 51 |
select count(*) from t1; |
| 52 |
count(*) |
| 53 |
81 |
| 54 |
update t1 set b = repeat('a', 100) where i < 100; |
| 55 |
select * from t1 limit 1; |
| 56 |
i b |
| 57 |
20 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
| 58 |
select count(*) from t1; |
| 59 |
count(*) |
| 60 |
81 |
| 61 |
rollback; |
| 62 |
update t1 set b = repeat('a', 100) where i < 100; |
| 63 |
select * from t1 limit 1; |
| 64 |
i b |
| 65 |
20 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
| 66 |
truncate table t1; |
| 67 |
select count(*) from t1; |
| 68 |
count(*) |
| 69 |
0 |
| 70 |
drop table if exists t1; |
| 71 |
drop procedure populate_t1; |
| 72 |
drop procedure populate_t1_small; |