1set global innodb_compression_algorithm = 1;
2create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
3show warnings;
4Level	Code	Message
5create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1 page_compressed=1;
6show warnings;
7Level	Code	Message
8create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=2 page_compressed=1;
9show warnings;
10Level	Code	Message
11show create table innodb_normal;
12Table	Create Table
13innodb_normal	CREATE TABLE `innodb_normal` (
14  `c1` bigint(20) NOT NULL,
15  `b` char(200) DEFAULT NULL
16) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1
17show create table innodb_compact;
18Table	Create Table
19innodb_compact	CREATE TABLE `innodb_compact` (
20  `c1` bigint(20) NOT NULL,
21  `b` char(200) DEFAULT NULL
22) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `encrypted`=yes `encryption_key_id`=1 `page_compressed`=1
23show create table innodb_dynamic;
24Table	Create Table
25innodb_dynamic	CREATE TABLE `innodb_dynamic` (
26  `c1` bigint(20) NOT NULL,
27  `b` char(200) DEFAULT NULL
28) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `encrypted`=yes `encryption_key_id`=2 `page_compressed`=1
29create procedure innodb_insert_proc (repeat_count int)
30begin
31declare current_num int;
32set current_num = 0;
33while current_num < repeat_count do
34insert into innodb_normal values(current_num, substring(MD5(RAND()), -128));
35set current_num = current_num + 1;
36end while;
37end//
38commit;
39begin;
40call innodb_insert_proc(2000);
41insert into innodb_compact select * from innodb_normal;
42insert into innodb_dynamic select * from innodb_normal;
43commit;
44FLUSH TABLES innodb_compact FOR EXPORT;
45UNLOCK TABLES;
46FLUSH TABLES innodb_dynamic FOR EXPORT;
47UNLOCK TABLES;
48select variable_value > 0 from information_schema.global_status
49where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
50variable_value > 0
511
52set global innodb_compression_algorithm = 1;
53alter table innodb_normal engine=innodb page_compressed=DEFAULT;
54show create table innodb_normal;
55Table	Create Table
56innodb_normal	CREATE TABLE `innodb_normal` (
57  `c1` bigint(20) NOT NULL,
58  `b` char(200) DEFAULT NULL
59) ENGINE=InnoDB DEFAULT CHARSET=latin1
60alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT;
61show create table innodb_compact;
62Table	Create Table
63innodb_compact	CREATE TABLE `innodb_compact` (
64  `c1` bigint(20) NOT NULL,
65  `b` char(200) DEFAULT NULL
66) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
67alter table innodb_dynamic engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT;
68show create table innodb_dynamic;
69Table	Create Table
70innodb_dynamic	CREATE TABLE `innodb_dynamic` (
71  `c1` bigint(20) NOT NULL,
72  `b` char(200) DEFAULT NULL
73) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
74FLUSH TABLES innodb_normal FOR EXPORT;
75UNLOCK TABLES;
76FLUSH TABLES innodb_compact FOR EXPORT;
77UNLOCK TABLES;
78FLUSH TABLES innodb_dynamic FOR EXPORT;
79UNLOCK TABLES;
80select variable_value > 0 from information_schema.global_status
81where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED';
82variable_value > 0
831
84drop procedure innodb_insert_proc;
85drop table innodb_normal;
86drop table innodb_compact;
87drop table innodb_dynamic;
88