Home > Enterprise >  How to take back storage from my postgres db
How to take back storage from my postgres db

Time:11-07

I have a table named duplicates_duplicatebackendentry_documents that has a size of 49gb. This table has 2 indexes that are each 25 gb. And two constraints that are also each 25gb.

The table is used by the duplicates module in a django app I deployed. I have now turned off the module. I am unable to run full vacuuum because I do not have the space necessary to run it. Deleting the table returns the storage (I tested in a dev env) but is there a way I can delete the bloat but keep the table, its constraints and indexes? I just want to empty the bloat along with all the contents.

Bloated table

table and object sizes

CodePudding user response:

I just want to empty the bloat along with all the contents.

The canonical way to do that is

TRUNCATE duplicates_duplicatebackendentry_documents;

which will render the table and all its indexes empty.

  • Related