Check all table size in Postgres

The “tables ” is in information_schema
The “pg_class” is in System Catalogs


SELECT ist.table_name, reltuples AS "entries", pg_size_pretty(relpages::bigint*8*1024) AS size
FROM information_schema.tables ist
INNER JOIN pg_class c ON (ist.table_name = c.relname)
WHERE
ist.table_catalog='ip2_sync_master'
AND ist.table_schema='public'
ORDER BY relpages DESC, ist.table_name ASC;

Leave a Reply

Your email address will not be published. Required fields are marked *


2 × = fourteen