star4476=# create table test(s varchar); CREATE TABLE Time: 2,634 ms star4476=# alter table test set (autovacuum_enabled = false, toast.autovacuum_enabled = false); ALTER TABLE Time: 0,221 ms star4476=# star4476=# select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test'; n_live_tup | n_dead_tup ------------+------------ 0 | 0 (1 row) Time: 12,386 ms star4476=# select reltuples, relpages from pg_class where relname = 'test'; reltuples | relpages -----------+---------- 0 | 0 (1 row) Time: 0,174 ms star4476=# explain select * from test; QUERY PLAN --------------------------------------------------------- Seq Scan on test (cost=0.00..23.60 rows=1360 width=32) (1 row) Time: 0,141 ms star4476=# star4476=# insert into test select 'x:' || x.id from generate_series(1, 1000000000) as x(id); INSERT 0 1000000000 Time: 809040,060 ms star4476=# star4476=# select pg_sleep(1); pg_sleep ---------- (1 row) Time: 1001,441 ms star4476=# select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test'; n_live_tup | n_dead_tup ------------+------------ 1000000000 | 0 (1 row) Time: 10,935 ms star4476=# select reltuples, relpages from pg_class where relname = 'test'; reltuples | relpages -----------+---------- 0 | 0 (1 row) Time: 0,096 ms star4476=# explain select * from test; QUERY PLAN -------------------------------------------------------------------- Seq Scan on test (cost=0.00..12756526.88 rows=735121888 width=32) (1 row) Time: 0,078 ms star4476=# star4476=# delete from test; DELETE 1000000000 Time: 482985,588 ms star4476=# star4476=# select pg_sleep(1); pg_sleep ---------- (1 row) Time: 1001,316 ms star4476=# select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test'; n_live_tup | n_dead_tup ------------+------------ 0 | 1000000000 (1 row) Time: 11,012 ms star4476=# select reltuples, relpages from pg_class where relname = 'test'; reltuples | relpages -----------+---------- 0 | 0 (1 row) Time: 0,115 ms star4476=# explain select * from test; QUERY PLAN -------------------------------------------------------------------- Seq Scan on test (cost=0.00..12756526.88 rows=735121888 width=32) (1 row) Time: 0,074 ms star4476=# star4476=# analyze verbose test; INFO: analyzing "public.test" INFO: "test": scanned 30000 of 5405308 pages, containing 0 live rows and 5550061 dead rows; 0 rows in sample, 0 estimated total rows ANALYZE Time: 284,481 ms star4476=# star4476=# select pg_sleep(1); pg_sleep ---------- (1 row) Time: 1001,279 ms star4476=# select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test'; n_live_tup | n_dead_tup ------------+------------ 0 | 999992971 (1 row) Time: 10,833 ms star4476=# select reltuples, relpages from pg_class where relname = 'test'; reltuples | relpages -----------+---------- 0 | 5405308 (1 row) Time: 0,092 ms star4476=# explain select * from test; QUERY PLAN ----------------------------------------------------------- Seq Scan on test (cost=0.00..5405308.00 rows=1 width=32) (1 row) Time: 0,209 ms star4476=# star4476=# insert into test select 'x:' || x.id from generate_series(1, 1000000000) as x(id); INSERT 0 1000000000 Time: 804891,195 ms star4476=# star4476=# select pg_sleep(1); pg_sleep ---------- (1 row) Time: 1001,226 ms star4476=# select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test'; n_live_tup | n_dead_tup ------------+------------ 1000000000 | 999992971 (1 row) Time: 10,967 ms star4476=# select reltuples, relpages from pg_class where relname = 'test'; reltuples | relpages -----------+---------- 0 | 5405308 (1 row) Time: 0,115 ms star4476=# explain select * from test; QUERY PLAN ------------------------------------------------------------ Seq Scan on test (cost=0.00..10810615.00 rows=1 width=32) (1 row) Time: 0,074 ms star4476=# star4476=# analyze verbose test; INFO: analyzing "public.test" INFO: "test": scanned 30000 of 10810615 pages, containing 2807827 live rows and 2742296 dead rows; 30000 rows in sample, 2807827 estimated total rows ANALYZE Time: 415,878 ms star4476=# star4476=# select pg_sleep(1); pg_sleep ---------- (1 row) Time: 1001,296 ms star4476=# select n_live_tup, n_dead_tup from pg_stat_user_tables where relname = 'test'; n_live_tup | n_dead_tup ------------+------------ 2807827 | 988196876 (1 row) Time: 10,706 ms star4476=# select reltuples, relpages from pg_class where relname = 'test'; reltuples | relpages -------------+---------- 2.80783e+06 | 10810615 (1 row) Time: 0,090 ms star4476=# explain select * from test; QUERY PLAN ------------------------------------------------------------------ Seq Scan on test (cost=0.00..10838693.27 rows=2807827 width=11) (1 row) Time: 0,259 ms