title: How to shrink pg_toast table?
body: <p>I am running on postgres 9.3 on mac osx and I have a database which grew out of control. I used to have table which had one column which stored large data. Then I noticed that there the db size grew up to around 19gb just because of a pg_toast table. Then I remove the mentioned column and ran vacuum in order to get the db to a smaller size again, but it remained the same. So how can I shrink the database size?</p>
  
  <pre><code> SELECT nspname || '.' || relname AS "relation"
         ,pg_size_pretty(pg_relation_size(C.oid)) AS "size" 
   FROM pg_class C 
       LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) 
   WHERE nspname NOT IN ('pg_catalog', 'information_schema') 
   ORDER BY pg_relation_size(C.oid) DESC 
   LIMIT 20;
  </code></pre>
  
  <p>results in </p>
  
  <pre><code> pg_toast.pg_toast_700305                    | 18 GB
   pg_toast.pg_toast_700305_index              | 206 MB
   public.catalog_hotelde_images               | 122 MB
   public.routes                               | 120 MB
  
  
  
      VACUUM VERBOSE ANALYZE pg_toast.pg_toast_700305;                                                                                                                                            INFO:  vacuuming "pg_toast.pg_toast_700305"
  INFO:  index "pg_toast_700305_index" now contains 9601330 row versions in 26329 pages
  DETAIL:  0 index row versions were removed.
  0 index pages have been deleted, 0 are currently reusable.
  CPU 0.06s/0.02u sec elapsed 0.33 sec.
  INFO:  "pg_toast_700305": found 0 removable, 0 nonremovable row versions in 0 out of 2393157 pages
  DETAIL:  0 dead row versions cannot be removed yet.
  There were 0 unused item pointers.
  0 pages are entirely empty.
  CPU 0.06s/0.07u sec elapsed 0.37 sec.
  VACUUM
  </code></pre>
  
  <p>structure of the routes table</p>
  
  <pre><code>id serial NOT NULL,
    origin_id integer,
    destination_id integer,
    total_time integer,
    total_distance integer,
    speed_id integer,
    uid bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    CONSTRAINT routes_pkey PRIMARY KEY (id)
  </code></pre>