bloated postgres data folder, clean up - Mailing list pgsql-general

From Rémi Cura
Subject bloated postgres data folder, clean up
Date
Msg-id CAJvUf_ugk3pbcVYjKFHYRCdfkSGdDZ+yCzMyZPHepOh=Loijfw@mail.gmail.com
Whole thread Raw
Responses Re: bloated postgres data folder, clean up  (Peter Devoy <peter@3xe.co.uk>)
Re: bloated postgres data folder, clean up  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-general
Hey dear list,
after a fex years of experiments and crash,
I ended up with a grossly bloated postgres folder.
I had about 8 Go of useless files.
All is in a virtualbox, so I'm sure to be able to reproduce exactly, and fried my postgres folder a couple of time before getting it right.

Julien (Rouhaud) helped me to find those useless files via SQL.
The idea is to list files in postgres directory with `pg_ls_dir`, then to check that the dir name correspond to something useful (using pg_relation_filenode).
------------------
https://gist.github.com/Remi-C/926eaee04d61a7245eb8
------------------

To be sure I export the found files list,
then use oid2name to check that no file is recognized.

files can then be deleted (using plpythonu in my case).

So far a vacuum full analyze raise no errors.

Warning : for this to work, the SQL query must be sent while connected to the database to clean.

Hope this may be useful
Cheers,
Rémi-C

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Only owners can ANALYZE tables...seems overly restrictive
Next
From: Geoff Winkless
Date:
Subject: Re: multicolumn index and setting effective_cache_size using human-readable-numbers