title: Estimating effect size of dropping columns in PostgreSQL
body: <p>I have a table in PostgreSQL with two columns containing images as text (not my decision ..). So, now I do not need these columns and I'm planning to delete them. But I'd faced a problem when I wanted to estimate the "effect" of dropping the columns, i.e. how much size of the table will change.
  The problem is that PostgreSQL shows the same size for old and new tables. Which is very weird because I'm dropping two "heavy" columns.</p>
  
  <p>Here is the code of comparison:</p>
  
  <pre><code>-- Create two copies of the table
  CREATE TABLE oldwords (LIKE "words" INCLUDING INDEXES); 
  INSERT INTO oldwords SELECT * FROM "words";
  
  CREATE TABLE newwords (LIKE "words" INCLUDING INDEXES); 
  INSERT INTO newwords SELECT * FROM "words";
  
  -- Drop columns containing images
  ALTER TABLE "newwords"
     DROP COLUMN image_black,
     DROP COLUMN image_colored;
  
  -- Update stats of the tables
  VACUUM ANALYZE "oldwords";
  VACUUM ANALYZE "newwords";
  
  -- Compare size
  SELECT
      relname as "Table",
      pg_size_pretty(pg_total_relation_size(relid)) As "Size",
      pg_size_pretty(pg_total_relation_size(relid) - 
      pg_relation_size(relid)) as "External Size"
  FROM pg_catalog.pg_statio_user_tables 
  WHERE relname LIKE '___words'
  ORDER BY pg_total_relation_size(relid) DESC
  
  -- RESULT
  Table       Size    External Size
  newwords    296 MB  205 MB
  oldwords    296 MB  205 MB
  </code></pre>
  
  <p>Am I doing something wrong? Why are the sizes same? And what is the correct way to do it?</p>