Postgres DB Size Command

后端 未结 10 562
孤独总比滥情好
孤独总比滥情好 2021-01-29 17:09

What is the command to find the size of all the databases?

I am able to find the size of a specific database by using following command:

         


        
10条回答
  •  南方客
    南方客 (楼主)
    2021-01-29 17:41

    Yes, there is a command to find the size of a database in Postgres. It's the following:

    SELECT pg_database.datname as "database_name", pg_size_pretty(pg_database_size(pg_database.datname)) AS size_in_mb FROM pg_database ORDER by size_in_mb DESC;
    

提交回复
热议问题