PostgreSQL Bloat Warning: Vaccuum does not help

postgresqlvacuum

We use check_postgres to monitor our DB. We get this warning:

POSTGRES_BLOAT WARNING: 
DB "foo" (db foo) index foo_text_index_id_uniq rows:? 
pages:485435 shouldbe:330673 (1.5X) wasted bytes:1267810304 (1 GB) 

According to the docs a vacuum should help, but the autovacuum does not help.

What can I do to get rid of the bloat?

Best Answer

Vacuuming will not remove the existing bloat. It will free up that space for future use. Until that future use has happened, it will still look bloated.

To free it up now, you would have to do something drastic like VACUUM FULL, CLUSTER, or use some external tool like pg_repack. That is a lot of churn to put your database through just to fix a problem that is not actually a problem.

I would just do as @KookieMonster said, and increase the threshold. Then if things start to get worse, eventually you will start getting warnings again. (Actually, I wouldn't run check_postgres in the first place, but if I were, then...see above.)