1 2 3 4 5 6 7 8 9 10 11

SELECT n . nspname as "Schema" , c . relname as "Table" , get_count ( n . nspname , c . relname ) FROM pg_catalog . pg_class c JOIN pg_catalog . pg_namespace n ON n . oid = c . relnamespace WHERE c . relkind = 'r' AND c . relstorage != 'x' -- excludes external tables AND n . nspname not in ( 'pg_catalog' , 'information_schema' ) AND c . oid not in ( SELECT inhrelid from pg_inherits ) --excludes child partition tables ORDER BY 3 desc ;