Thread: VACUUM FULL, power failure results in unrecoverable space
Hello,
I encountered an issue while attempting to reclaim space from a heavily bloated table:
Initial analysis using https://github.com/ioguix/pgsql-bloat-estimation/blob/master/table/table_bloat.sql indicated approximately 600GB of bloat in the table.
I initiated a VACUUM FULL operation to reclaim this space, but during execution, the server experienced a power failure.
After server recovery:
1. The database came back online successfully
2. The space used by the in-progress table reconstruction was not freed
3. The newly wasted space (bloat + partial VACUUM FULL) is not shown using the above query, only the initial bloat.
Is there a way to reclaim this space without resorting to a full pg_dump and pg_restore cycle?
Thanks.
Best,
Pierre
Hi,
Le mar. 3 déc. 2024, 01:02, Pierre Barre <pierre@barre.sh> a écrit :
Hello,I encountered an issue while attempting to reclaim space from a heavily bloated table:Initial analysis using https://github.com/ioguix/pgsql-bloat-estimation/blob/master/table/table_bloat.sql indicated approximately 600GB of bloat in the table.I initiated a VACUUM FULL operation to reclaim this space, but during execution, the server experienced a power failure.After server recovery:1. The database came back online successfully2. The space used by the in-progress table reconstruction was not freed
Because doesn't know it's here.
3. The newly wasted space (bloat + partial VACUUM FULL) is not shown using the above query, only the initial bloat.
Because it's not the same kind of bloat. Vacuum full builds another set of files for the table, and these files aren't yet connected to the table, since vacuum full didn't finish. You've got some orphaned files you'll have to delete.
Is there a way to reclaim this space without resorting to a full pg_dump and pg_restore cycle?
You can dump and restore (which will drop all bloat of this database), but will probably take too long to finish. You can also see pg_orphaned to know which files to delete (https://github.com/bdrouvot/pg_orphaned).
Regards.
--
Guillaume.