Here are the top bloated tables before and after running a manual vacuum operation on all the tables in a heroku managed postgresql 9.2 database. As you can see, not much has changed, some waste has even increased...
What could the reason be? Is this normal behavior?
Before:
type | schemaname | object_name | bloat | waste
-------+------------+------------------------+-------+------------
index | public | table_1 | 1.4 | 113 MB
table | public | table_2 | 1.1 | 92 MB
table | public | table_3 | 1.1 | 70 MB
index | public | table_4 | 1.2 | 66 MB
index | public | table_5 | 1.2 | 65 MB
index | public | table_6 | 1.2 | 64 MB
index | public | table_7 | 1.1 | 34 MB
table | public | table_8 | 1.1 | 19 MB
After:
type | schemaname | object_name | bloat | waste
-------+------------+------------------------+-------+------------
index | public | table_1 | 1.4 | 123 MB
table | public | table_2 | 1.1 | 82 MB
table | public | table_3 | 1.1 | 82 MB
index | public | table_4 | 1.3 | 72 MB
index | public | table_5 | 1.3 | 72 MB
index | public | table_6 | 1.3 | 71 MB
index | public | table_7 | 1.1 | 39 MB
table | public | table_8 | 1.1 | 19 MB
VACUUM FULL
to shrink the tables to minimum size, but the effect will be temporary. Also do not forget about vacuuming indexes. – Ihor Romanchenko