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

show shared_buffers;

\timing

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

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

vacuum test;

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

--select max(ctid) from test;
--(442477,198)

--select * from pg_backend_pid();

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

vacuum (verbose, truncate off) test;
