Tell me more ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Postgres tablespace is cluster-wide. Therefore, how do I caculated how much space allocated by each database in postgres tablespace ?

share|improve this question

migrated from stackoverflow.com Mar 8 '12 at 6:47

1 Answer

To get the disk space occupied by a database (nicely formatted):

SELECT pg_size_pretty(pg_database_size('mydb'))

Disk space occupied by a tablespace:

SELECT pg_size_pretty(pg_tablespace_size('mytblspace'))

Find out more about database object size functions in the manual:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.