1

I am running out of disk space on my database server. I have never executed a vacuum full and I'm hoping that vacuum full will free some space.

Have you run vacuum full before, and if space was freed up, how much was it?

Valeriy
  • 1,365
  • 3
  • 18
  • 45
  • You might want to have a look at tools like [pg_squeeze](https://github.com/cybertec-postgresql/pg_squeeze) or [pg_repack](http://reorg.github.io/pg_repack/). – Laurenz Albe Nov 07 '17 at 08:46

1 Answers1

2

physically vacuum full makes a copy of table and destroys an old one. This leads to several conclusions:

  • if you are low on space you might be not able to run it
  • you will release as much space as it is taken by deleted tuples

https://www.postgresql.org/docs/current/static/sql-vacuum.html

This method also requires extra disk space, since it writes a new copy of the table and doesn't release the old copy until the operation is complete. Usually this should only be used when a significant amount of space needs to be reclaimed from within the table.

You can find out the size of your data without gaps, by taking restoring copy of it, eg pg_dump/pg_restore

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
Vao Tsun
  • 47,234
  • 13
  • 100
  • 132