2

I run df -h and it says 36Gb used, 9Gb available on my server. I can see that my PostgreSQL db file is 26Gb.

I delete millions of rows from my database, roughly half of the data in there.

I run df -h and it says the exact same numbers: 36Gb used, 9Gb available on disk.

I googled and found something about the VACUUM command, which said the deleted rows are still taking disk space until you run vacuum, I did this in verbose mode and it looks good but still no disk space released.

jsstuball
  • 4,104
  • 7
  • 33
  • 63
  • 5
    `VACUUM FULL` https://www.postgresql.org/docs/10/static/sql-vacuum.html – wildplasser Jan 07 '18 at 17:08
  • That didn't help at all, must be the same issue as why VACUUM didn't help – jsstuball Jan 07 '18 at 18:23
  • 1
    `VACUUM` doesn't reclaim space, `VACUUM FULL` and `CLUSTER` do. If you run `\dt+` in your database, do the table sizes match that 26GB you're expecting? If you can afford downtime, you have many options: pg_dump backup + create new db + pg_restore, or for the bloated tables, create a new table using select (aka "CTAS") then renaming it or truncate+copy the data back in, or pg_repack, or use TRUNCATE instead of DELETE (if you want to remove all data and reclaim space in the table immediately). Lots of options, but they all depend on your env and if you can afford downtime. – bma Jan 07 '18 at 19:35

0 Answers0