I (successfully) followed the upgrade procedure in §18.6.1 of the PostgreSQL Manual to upgrade a PostgreSQL database cluster from 10.7 to 11.2 (running Fedora 29). I would like to remove the old tablepaces (some of which are user-defined tablespaces) and other legacy files to reclaim space not needed from the old cluster.
There are two approaches I’ve considered:
- Connect to the old database cluster as
postgres
and run queries against the pg_catalog system tables to DROP tables, tablespaces, databases, etc. - Run
find -L /path/to/tablespace/root -type d -user postgres -iname “PG_10_*” exec rm -rf {} \;
to remove directories in the tablespace locations (note the new tablespaces share the same root directory as the old ones)
After either (1) or (2), I’d remove the old PGDATA
directory.
Is there a preferred approach (including any methods not mentioned)?
Note, this is distinct from the following post: How do I uninstall the old version of Postgres on CentOS 7