\echo 'autovcuum should probably be disabled:'
show autovacuum;
drop table if exists sec_idx_bloat;
create table sec_idx_bloat (i int4);
create index bloated on sec_idx_bloat (i);
\echo 'Initial insert of 1e7 sequential values:'
insert into sec_idx_bloat select i from generate_series(1,1e7) i;
\di+
\echo 'Initial insert of the value 42 1e7 times:'
insert into sec_idx_bloat select 42 from generate_series(1,1e7) i;
\di+
\echo 'Repeated insertion of the value 42 1e7 times:'
insert into sec_idx_bloat select 42 from generate_series(1,1e7) i;
\di+
\echo 'Delete + VACUUM away most of the dups:'
delete from sec_idx_bloat where i = 42 and random() < 0.9;
vacuum sec_idx_bloat;
\di+
\echo 'Third insertion of the value 42 1e7 times:'
insert into sec_idx_bloat select 42 from generate_series(1,1e7) i;
\di+
\echo 'Fourth insertion of the value 42 1e7 times:'
insert into sec_idx_bloat select 42 from generate_series(1,1e7) i;
\di+
