Skip navigation

Getting Database size:
SELECT pg_database_size(‘user’);
pg_database_size
——————
58241934

Oh.. thats in Bytes.. Make it nicer.. Get db size in MBs.

SELECT pg_size_pretty(pg_database_size(‘user_table’));
pg_size_pretty
—————-
60 MB

Getting Table size:

SELECT pg_size_pretty(pg_total_relation_size(‘user_table’));
pg_size_pretty
—————-
55 MB

Leave a Reply

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

*


− 6 = one

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>