
--alter system set shared_buffers ='4GB';
--restart
alter system set maintenance_work_mem = '1GB';
select pg_reload_conf();

show shared_buffers;

\timing

--------------------------------------
drop table if exists test;
create unlogged table if not exists test (x uuid) with (autovacuum_enabled=false);

insert into test (x) select gen_random_uuid() from generate_series(1,100*1000*1000);
select pg_size_pretty(pg_table_size('test'));
--4224 MB

vacuum test;

create index on test (x);
select pg_size_pretty(pg_total_relation_size('test'));
--7232 MB

--select max(ctid) from test;
-- (540540,100)

--select * from pg_backend_pid();

-- delete ~20% at the end
delete from test where ctid > '(432000,0)'::tid;

vacuum (verbose, truncate off) test;
