Postgres - how much space is required to perform a VACUUM
how much space is required to perform a VACUUM


At worst pg_total_relation_size(table) * 2. Usually lots less because the new table and indexes are significantly more compact.


  How do I free OS space in a POSTGRES database when I know there is unused space available, but there's not enough space to run a VACUUM?


Clean up unrelated files on the volume. Drop some tables or indexes you don't need. Move tables or indexes to other tablespaces on other storage. Expand the underlying volume.

There isn't really a good way to compact in-place and free space to the OS without first needing to allocate more space. I think most people agree this is a flaw, but nobody seems to care enough to develop any improvement for it.