\timing on

drop table if exists test;
create table test(s varchar);
alter table test set (autovacuum_enabled = false, toast.autovacuum_enabled = false);

select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test';
select reltuples, relpages from pg_class where relname = 'test';
explain select * from test;

insert into test select 'x:' || x.id from generate_series(1, 1000000000) as x(id);

select pg_sleep(1);
select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test';
select reltuples, relpages from pg_class where relname = 'test';
explain select * from test;

delete from test;

select pg_sleep(1);
select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test';
select reltuples, relpages from pg_class where relname = 'test';
explain select * from test;

analyze verbose test;

select pg_sleep(1);
select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test';
select reltuples, relpages from pg_class where relname = 'test';
explain select * from test;

insert into test select 'x:' || x.id from generate_series(1, 1000000000) as x(id);

select pg_sleep(1);
select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test';
select reltuples, relpages from pg_class where relname = 'test';
explain select * from test;

analyze verbose test;

select pg_sleep(1);
select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test';
select reltuples, relpages from pg_class where relname = 'test';
explain select * from test;

