Getting Database and Table Sizes in Postgres

Total Database Size This SQL simply gets the total size of the database in a human readable format. SELECT pg_size_pretty(pg_database_size(‘postgres’)) as db_size List all Tables This lists all the tables in the database public schema. SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = ‘public’ Search Schema for Column Name I often need to search all the …