title: Why table size doesn't change after vacuum full?
body: <p>Here is then code. Lets create table with 10000 rows of data.</p>
  
  <p>DB version is PostgreSQL 9.5.3 on x86_64-suse-linux-gnu</p>
  
  <pre><code>drop table if exists test;
  
  create table test as 
  select gs as id, md5(gs::text) as value from generate_series(1,10000) gs;
  
  create unique index test_id_pkey on test using btree(id);
  alter table test add primary key using index test_id_pkey;
  analyze test;
  
  select pg, pg_size_pretty(pg) pz from pg_relation_size('test') pg;
  
  Results of last query: 672kb
  Now
  
  delete from test where id &gt; 1000;
  </code></pre>
  
  <p>size of table was reduced like 10 times. Now lets vacuum it. According documentation vacuum full make of copy of table on disk and write into it only alive rows, those are only 10% of original.</p>
  
  <pre><code>vacuum full test;
  select pg, pg_size_pretty(pg) pz from pg_relation_size('test') pg;
  
  Still size of table is 672kb
  </code></pre>
  
  <p>Let's try trick with <strong>alter table</strong> statement which will do the same. Create a new copy of table on disk and write into it only alive rows</p>
  
  <pre><code>alter table jenkins.test alter column id type int;
  select pg, pg_size_pretty(pg) pz from pg_relation_size('test') pg;
  
  Still size of table is 672kb;
  </code></pre>
  
  <p>Now let's create a new table copy of current table sized 672kb</p>
  
  <pre><code>drop table if exists test1;
  create table test1 as 
  select * from test;
  
  create unique index test1_id_pkey on test1 using btree(id);
  alter table test1 add primary key using index test1_id_pkey;
  analyze test1;
  select pg, pg_size_pretty(pg) pz from pg_relation_size('test1') pg
  </code></pre>
  
  <p>Surprisingly size of this table is just 72kb. Vacuuming throw warning messages</p>
  
  <pre><code>INFO:  "test": found 0 removable, 10000 nonremovable row versions in 84 pages
  DETAIL:  9000 dead row versions cannot be removed yet.
  </code></pre>
  
  <p>It is just an example. I tried to add more row up to 1_000_000 still the same.
  When table row become removable?
  How to deal with such situations or to be ready to?</p>