Check all table size in Postgres

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

1
2
3
4
5
6
7
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;
This entry was posted in Database, PostgreSQL. Bookmark the permalink.

Leave a Reply

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

*


six − 4 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>