Here is a script to get the top 20 biggest tables
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', 'pg_toast' ) ORDER BY pg_relation_size(C.oid) DESC LIMIT 20;
Cheers!
Leave a Reply