mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
7cf97ed4ee
MySQL 5.7 allows temporary tables to be created in ROW_FORMAT=COMPRESSED. The usefulness of this is questionable. WL#7899 in MySQL 8.0.0 prevents the creation of such compressed tables, so that all InnoDB temporary tables will be located inside the predefined InnoDB temporary tablespace. Pick up and adjust some tests from MySQL 5.7 and 8.0. dict_tf_to_fsp_flags(): Remove the parameter is_temp. fsp_flags_init(): Remove the parameter is_temporary. row_mysql_drop_temp_tables(): Remove. There cannot be any temporary tables in InnoDB. (This never removed #sql* tables in the datadir which were created by DDL.) dict_table_t::dir_path_of_temp_table: Remove. create_table_info_t::m_temp_path: Remove. create_table_info_t::create_options_are_invalid(): Do not allow ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE for temporary tables. create_table_info_t::innobase_table_flags(): Do not unnecessarily prevent CREATE TEMPORARY TABLE with SPATIAL INDEX. (MySQL 5.7 does allow this.) fil_space_belongs_in_lru(): The only FIL_TYPE_TEMPORARY tablespace is never subjected to closing least-recently-used files.
597 lines
8.3 KiB
Text
597 lines
8.3 KiB
Text
create temporary table t1
|
|
(keyc int, c1 char(100), c2 char(100),
|
|
primary key(keyc), index sec_index(c1)
|
|
) engine = innodb;
|
|
create temporary table t2
|
|
(keyc int, c1 char(100), c2 char(100),
|
|
primary key(keyc), index sec_index(c1)
|
|
) engine = innodb;
|
|
create procedure populate_t1()
|
|
begin
|
|
declare i int default 1;
|
|
while (i <= 200) do
|
|
insert into t1 values (i, 'a', 'b');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
create procedure populate_t1_small()
|
|
begin
|
|
declare i int default 1;
|
|
while (i <= 20) do
|
|
insert into t1 values (i, 'c', 'd');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
create procedure populate_t1_small2()
|
|
begin
|
|
declare i int default 30;
|
|
while (i <= 50) do
|
|
insert into t1 values (i, 'e', 'f');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
begin;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
call populate_t1();
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
1 a b
|
|
2 a b
|
|
3 a b
|
|
4 a b
|
|
5 a b
|
|
6 a b
|
|
7 a b
|
|
8 a b
|
|
9 a b
|
|
10 a b
|
|
rollback;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
begin;
|
|
call populate_t1();
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
commit;
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
truncate table t1;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
call populate_t1_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
20
|
|
rollback;
|
|
select count(*) from t1;
|
|
count(*)
|
|
20
|
|
truncate table t1;
|
|
call populate_t1();
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
delete from t1 where keyc <= 60;
|
|
select count(*) from t1;
|
|
count(*)
|
|
140
|
|
call populate_t1_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
160
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
1 c d
|
|
2 c d
|
|
3 c d
|
|
4 c d
|
|
5 c d
|
|
6 c d
|
|
7 c d
|
|
8 c d
|
|
9 c d
|
|
10 c d
|
|
begin;
|
|
call populate_t1_small2();
|
|
select count(*) from t1;
|
|
count(*)
|
|
181
|
|
select * from t1 where keyc > 30 limit 10;
|
|
keyc c1 c2
|
|
31 e f
|
|
32 e f
|
|
33 e f
|
|
34 e f
|
|
35 e f
|
|
36 e f
|
|
37 e f
|
|
38 e f
|
|
39 e f
|
|
40 e f
|
|
rollback;
|
|
select count(*) from t1;
|
|
count(*)
|
|
160
|
|
select * from t1 where keyc > 30 limit 10;
|
|
keyc c1 c2
|
|
61 a b
|
|
62 a b
|
|
63 a b
|
|
64 a b
|
|
65 a b
|
|
66 a b
|
|
67 a b
|
|
68 a b
|
|
69 a b
|
|
70 a b
|
|
update t1 set keyc = keyc + 2000;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
2001 c d
|
|
2002 c d
|
|
2003 c d
|
|
2004 c d
|
|
2005 c d
|
|
2006 c d
|
|
2007 c d
|
|
2008 c d
|
|
2009 c d
|
|
2010 c d
|
|
rollback;
|
|
begin;
|
|
update t1 set keyc = keyc + 2000;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
4001 c d
|
|
4002 c d
|
|
4003 c d
|
|
4004 c d
|
|
4005 c d
|
|
4006 c d
|
|
4007 c d
|
|
4008 c d
|
|
4009 c d
|
|
4010 c d
|
|
rollback;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
2001 c d
|
|
2002 c d
|
|
2003 c d
|
|
2004 c d
|
|
2005 c d
|
|
2006 c d
|
|
2007 c d
|
|
2008 c d
|
|
2009 c d
|
|
2010 c d
|
|
commit;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
2001 c d
|
|
2002 c d
|
|
2003 c d
|
|
2004 c d
|
|
2005 c d
|
|
2006 c d
|
|
2007 c d
|
|
2008 c d
|
|
2009 c d
|
|
2010 c d
|
|
insert into t2 select * from t1 where keyc < 2101;
|
|
select count(*) from t2;
|
|
count(*)
|
|
60
|
|
drop procedure populate_t1;
|
|
drop procedure populate_t1_small;
|
|
drop procedure populate_t1_small2;
|
|
drop temporary table t1,t2;
|
|
create temporary table t1
|
|
(keyc int, c1 char(100), c2 char(100),
|
|
primary key(keyc), index sec_index(c1)
|
|
) engine = innodb key_block_size = 4;
|
|
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
|
|
create temporary table t1
|
|
(keyc int, c1 char(100), c2 char(100),
|
|
primary key(keyc), index sec_index(c1)
|
|
) engine = innodb;
|
|
set innodb_strict_mode=off;
|
|
create temporary table t2
|
|
(keyc int, c1 char(100), c2 char(100),
|
|
primary key(keyc), index sec_index(c1)
|
|
) engine = innodb key_block_size = 8;
|
|
set innodb_strict_mode=on;
|
|
create procedure populate_t1()
|
|
begin
|
|
declare i int default 1;
|
|
while (i <= 200) do
|
|
insert into t1 values (i, 'a', 'b');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
create procedure populate_t1_small()
|
|
begin
|
|
declare i int default 1;
|
|
while (i <= 20) do
|
|
insert into t1 values (i, 'c', 'd');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
create procedure populate_t1_small2()
|
|
begin
|
|
declare i int default 30;
|
|
while (i <= 50) do
|
|
insert into t1 values (i, 'e', 'f');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
begin;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
call populate_t1();
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
1 a b
|
|
2 a b
|
|
3 a b
|
|
4 a b
|
|
5 a b
|
|
6 a b
|
|
7 a b
|
|
8 a b
|
|
9 a b
|
|
10 a b
|
|
rollback;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
begin;
|
|
call populate_t1();
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
commit;
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
truncate table t1;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
call populate_t1_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
20
|
|
rollback;
|
|
select count(*) from t1;
|
|
count(*)
|
|
20
|
|
truncate table t1;
|
|
call populate_t1();
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
delete from t1 where keyc <= 60;
|
|
select count(*) from t1;
|
|
count(*)
|
|
140
|
|
call populate_t1_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
160
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
1 c d
|
|
2 c d
|
|
3 c d
|
|
4 c d
|
|
5 c d
|
|
6 c d
|
|
7 c d
|
|
8 c d
|
|
9 c d
|
|
10 c d
|
|
begin;
|
|
call populate_t1_small2();
|
|
select count(*) from t1;
|
|
count(*)
|
|
181
|
|
select * from t1 where keyc > 30 limit 10;
|
|
keyc c1 c2
|
|
31 e f
|
|
32 e f
|
|
33 e f
|
|
34 e f
|
|
35 e f
|
|
36 e f
|
|
37 e f
|
|
38 e f
|
|
39 e f
|
|
40 e f
|
|
rollback;
|
|
select count(*) from t1;
|
|
count(*)
|
|
160
|
|
select * from t1 where keyc > 30 limit 10;
|
|
keyc c1 c2
|
|
61 a b
|
|
62 a b
|
|
63 a b
|
|
64 a b
|
|
65 a b
|
|
66 a b
|
|
67 a b
|
|
68 a b
|
|
69 a b
|
|
70 a b
|
|
update t1 set keyc = keyc + 2000;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
2001 c d
|
|
2002 c d
|
|
2003 c d
|
|
2004 c d
|
|
2005 c d
|
|
2006 c d
|
|
2007 c d
|
|
2008 c d
|
|
2009 c d
|
|
2010 c d
|
|
rollback;
|
|
begin;
|
|
update t1 set keyc = keyc + 2000;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
4001 c d
|
|
4002 c d
|
|
4003 c d
|
|
4004 c d
|
|
4005 c d
|
|
4006 c d
|
|
4007 c d
|
|
4008 c d
|
|
4009 c d
|
|
4010 c d
|
|
rollback;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
2001 c d
|
|
2002 c d
|
|
2003 c d
|
|
2004 c d
|
|
2005 c d
|
|
2006 c d
|
|
2007 c d
|
|
2008 c d
|
|
2009 c d
|
|
2010 c d
|
|
commit;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
2001 c d
|
|
2002 c d
|
|
2003 c d
|
|
2004 c d
|
|
2005 c d
|
|
2006 c d
|
|
2007 c d
|
|
2008 c d
|
|
2009 c d
|
|
2010 c d
|
|
insert into t2 select * from t1 where keyc < 2101;
|
|
select count(*) from t2;
|
|
count(*)
|
|
60
|
|
drop procedure populate_t1;
|
|
drop procedure populate_t1_small;
|
|
drop procedure populate_t1_small2;
|
|
drop temporary table t1, t2;
|
|
create temporary table t1
|
|
(keyc int, c1 char(100), c2 char(100),
|
|
primary key(keyc), index sec_index(c1)
|
|
) engine = innodb;
|
|
create temporary table t2
|
|
(keyc int, c1 char(100), c2 char(100),
|
|
primary key(keyc), index sec_index(c1)
|
|
) engine = innodb;
|
|
create procedure populate_t1()
|
|
begin
|
|
declare i int default 1;
|
|
while (i <= 200) do
|
|
insert into t1 values (i, 'a', 'b');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
create procedure populate_t1_small()
|
|
begin
|
|
declare i int default 1;
|
|
while (i <= 20) do
|
|
insert into t1 values (i, 'c', 'd');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
create procedure populate_t1_small2()
|
|
begin
|
|
declare i int default 30;
|
|
while (i <= 50) do
|
|
insert into t1 values (i, 'e', 'f');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
begin;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
call populate_t1();
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
1 a b
|
|
2 a b
|
|
3 a b
|
|
4 a b
|
|
5 a b
|
|
6 a b
|
|
7 a b
|
|
8 a b
|
|
9 a b
|
|
10 a b
|
|
rollback;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
begin;
|
|
call populate_t1();
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
commit;
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
truncate table t1;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
call populate_t1_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
20
|
|
rollback;
|
|
select count(*) from t1;
|
|
count(*)
|
|
20
|
|
truncate table t1;
|
|
call populate_t1();
|
|
select count(*) from t1;
|
|
count(*)
|
|
200
|
|
delete from t1 where keyc <= 60;
|
|
select count(*) from t1;
|
|
count(*)
|
|
140
|
|
call populate_t1_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
160
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
1 c d
|
|
2 c d
|
|
3 c d
|
|
4 c d
|
|
5 c d
|
|
6 c d
|
|
7 c d
|
|
8 c d
|
|
9 c d
|
|
10 c d
|
|
begin;
|
|
call populate_t1_small2();
|
|
select count(*) from t1;
|
|
count(*)
|
|
181
|
|
select * from t1 where keyc > 30 limit 10;
|
|
keyc c1 c2
|
|
31 e f
|
|
32 e f
|
|
33 e f
|
|
34 e f
|
|
35 e f
|
|
36 e f
|
|
37 e f
|
|
38 e f
|
|
39 e f
|
|
40 e f
|
|
rollback;
|
|
select count(*) from t1;
|
|
count(*)
|
|
160
|
|
select * from t1 where keyc > 30 limit 10;
|
|
keyc c1 c2
|
|
61 a b
|
|
62 a b
|
|
63 a b
|
|
64 a b
|
|
65 a b
|
|
66 a b
|
|
67 a b
|
|
68 a b
|
|
69 a b
|
|
70 a b
|
|
update t1 set keyc = keyc + 2000;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
2001 c d
|
|
2002 c d
|
|
2003 c d
|
|
2004 c d
|
|
2005 c d
|
|
2006 c d
|
|
2007 c d
|
|
2008 c d
|
|
2009 c d
|
|
2010 c d
|
|
rollback;
|
|
begin;
|
|
update t1 set keyc = keyc + 2000;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
4001 c d
|
|
4002 c d
|
|
4003 c d
|
|
4004 c d
|
|
4005 c d
|
|
4006 c d
|
|
4007 c d
|
|
4008 c d
|
|
4009 c d
|
|
4010 c d
|
|
rollback;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
2001 c d
|
|
2002 c d
|
|
2003 c d
|
|
2004 c d
|
|
2005 c d
|
|
2006 c d
|
|
2007 c d
|
|
2008 c d
|
|
2009 c d
|
|
2010 c d
|
|
commit;
|
|
select * from t1 limit 10;
|
|
keyc c1 c2
|
|
2001 c d
|
|
2002 c d
|
|
2003 c d
|
|
2004 c d
|
|
2005 c d
|
|
2006 c d
|
|
2007 c d
|
|
2008 c d
|
|
2009 c d
|
|
2010 c d
|
|
insert into t2 select * from t1 where keyc < 2101;
|
|
select count(*) from t2;
|
|
count(*)
|
|
60
|
|
drop procedure populate_t1;
|
|
drop procedure populate_t1_small;
|
|
drop procedure populate_t1_small2;
|