show global variables like 'innodb_file%';

set global innodb_compression_algorithm=zlib;

show global variables like '%compress%';


create table uncompressed_test_table (id int, random_data varchar(36), static_int int, static_varchar varchar(10)) engine=innodb;
create table compressed_test_table (id int, random_data varchar(36), static_int int, static_varchar varchar(10)) engine=innodb page_compressed=1;

insert into uncompressed_test_table(id, random_data, static_int, static_varchar)
select id, random_data, 42, 'Hello'
    from (
        with recursive data_generator(id, random_data) as (
                select 1 as id, uuid() as random_data
                union all
                select id + 1, uuid() from data_generator where id < 1000000
            )
        select * from data_generator
    ) as a;

insert into compressed_test_table(id, random_data, static_int, static_varchar)
select id, random_data, 42, 'Hello'
    from (
        with recursive data_generator(id, random_data) as (
                select 1 as id, uuid() as random_data
                union all
                select id + 1, uuid() from data_generator where id < 1000000
            )
        select * from data_generator
    ) as a;	

commit;

show global status like '%compress%';