We have recently partitioned a master table with couple of millions of rows. This table is partitioned by "id range". There are 7 child tables created under this master table and entries are going into the child table during insert. All these are managed by pg_partman extension.
While running this query, the master table is shown to occupy about 300GB of disk space. This is strange because this table has no entries and I could confirm that by running check_parent() function.
SELECT nspname || '.' || relname AS "relation",pg_size_pretty(pg_relation_size(C.oid)) AS "size" FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema') ORDER BY pg_relation_size(C.oid) DESC LIMIT 30;
We never had this problem while partitioning this table in other environments, where the data is not that much. Could this be due to unreleased disk space during partitioning?